home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Applications / Python 1.3 / source code / Doc / ref6.tex < prev    next >
LaTeX Document  |  1995-12-17  |  19.2 KB  |  [TEXT/R*ch]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: LaTeX Document (document/latex).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert LaTeX Document (document/latex) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file LaTeX document text default
99% file LaTeX document, ASCII text, with CR line terminators default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/281 LaTeX (Subdocument) default
100% detectItEasy Format: plain text[CR] default (weak)


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[R*ch]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 5c 63 68 61 70 74 65 72 | 7b 53 69 6d 70 6c 65 20 |\chapter|{Simple |
|00000010| 73 74 61 74 65 6d 65 6e | 74 73 7d 0d 5c 69 6e 64 |statemen|ts}.\ind|
|00000020| 65 78 69 69 7b 73 69 6d | 70 6c 65 7d 7b 73 74 61 |exii{sim|ple}{sta|
|00000030| 74 65 6d 65 6e 74 7d 0d | 0d 53 69 6d 70 6c 65 20 |tement}.|.Simple |
|00000040| 73 74 61 74 65 6d 65 6e | 74 73 20 61 72 65 20 63 |statemen|ts are c|
|00000050| 6f 6d 70 72 69 73 65 64 | 20 77 69 74 68 69 6e 20 |omprised| within |
|00000060| 61 20 73 69 6e 67 6c 65 | 20 6c 6f 67 69 63 61 6c |a single| logical|
|00000070| 20 6c 69 6e 65 2e 0d 53 | 65 76 65 72 61 6c 20 73 | line..S|everal s|
|00000080| 69 6d 70 6c 65 20 73 74 | 61 74 65 6d 65 6e 74 73 |imple st|atements|
|00000090| 20 6d 61 79 20 6f 63 63 | 75 72 20 6f 6e 20 61 20 | may occ|ur on a |
|000000a0| 73 69 6e 67 6c 65 20 6c | 69 6e 65 20 73 65 70 61 |single l|ine sepa|
|000000b0| 72 61 74 65 64 0d 62 79 | 20 73 65 6d 69 63 6f 6c |rated.by| semicol|
|000000c0| 6f 6e 73 2e 20 20 54 68 | 65 20 73 79 6e 74 61 78 |ons. Th|e syntax|
|000000d0| 20 66 6f 72 20 73 69 6d | 70 6c 65 20 73 74 61 74 | for sim|ple stat|
|000000e0| 65 6d 65 6e 74 73 20 69 | 73 3a 0d 0d 5c 62 65 67 |ements i|s:..\beg|
|000000f0| 69 6e 7b 76 65 72 62 61 | 74 69 6d 7d 0d 73 69 6d |in{verba|tim}.sim|
|00000100| 70 6c 65 5f 73 74 6d 74 | 3a 20 20 20 20 65 78 70 |ple_stmt|: exp|
|00000110| 72 65 73 73 69 6f 6e 5f | 73 74 6d 74 0d 20 20 20 |ression_|stmt. |
|00000120| 20 20 20 20 20 20 20 20 | 20 20 20 7c 20 61 73 73 | | | ass|
|00000130| 69 67 6e 6d 65 6e 74 5f | 73 74 6d 74 0d 20 20 20 |ignment_|stmt. |
|00000140| 20 20 20 20 20 20 20 20 | 20 20 20 7c 20 70 61 73 | | | pas|
|00000150| 73 5f 73 74 6d 74 0d 20 | 20 20 20 20 20 20 20 20 |s_stmt. | |
|00000160| 20 20 20 20 20 7c 20 64 | 65 6c 5f 73 74 6d 74 0d | | d|el_stmt.|
|00000170| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 7c 20 | | | |
|00000180| 70 72 69 6e 74 5f 73 74 | 6d 74 0d 20 20 20 20 20 |print_st|mt. |
|00000190| 20 20 20 20 20 20 20 20 | 20 7c 20 72 65 74 75 72 | | | retur|
|000001a0| 6e 5f 73 74 6d 74 0d 20 | 20 20 20 20 20 20 20 20 |n_stmt. | |
|000001b0| 20 20 20 20 20 7c 20 72 | 61 69 73 65 5f 73 74 6d | | r|aise_stm|
|000001c0| 74 0d 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |t. | |
|000001d0| 7c 20 62 72 65 61 6b 5f | 73 74 6d 74 0d 20 20 20 || break_|stmt. |
|000001e0| 20 20 20 20 20 20 20 20 | 20 20 20 7c 20 63 6f 6e | | | con|
|000001f0| 74 69 6e 75 65 5f 73 74 | 6d 74 0d 20 20 20 20 20 |tinue_st|mt. |
|00000200| 20 20 20 20 20 20 20 20 | 20 7c 20 69 6d 70 6f 72 | | | impor|
|00000210| 74 5f 73 74 6d 74 0d 20 | 20 20 20 20 20 20 20 20 |t_stmt. | |
|00000220| 20 20 20 20 20 7c 20 67 | 6c 6f 62 61 6c 5f 73 74 | | g|lobal_st|
|00000230| 6d 74 0d 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |mt. | |
|00000240| 20 7c 20 61 63 63 65 73 | 73 5f 73 74 6d 74 0d 20 | | acces|s_stmt. |
|00000250| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 7c 20 65 | | | e|
|00000260| 78 65 63 5f 73 74 6d 74 | 0d 5c 65 6e 64 7b 76 65 |xec_stmt|.\end{ve|
|00000270| 72 62 61 74 69 6d 7d 0d | 0d 5c 73 65 63 74 69 6f |rbatim}.|.\sectio|
|00000280| 6e 7b 45 78 70 72 65 73 | 73 69 6f 6e 20 73 74 61 |n{Expres|sion sta|
|00000290| 74 65 6d 65 6e 74 73 7d | 0d 5c 69 6e 64 65 78 69 |tements}|.\indexi|
|000002a0| 69 7b 65 78 70 72 65 73 | 73 69 6f 6e 7d 7b 73 74 |i{expres|sion}{st|
|000002b0| 61 74 65 6d 65 6e 74 7d | 0d 0d 45 78 70 72 65 73 |atement}|..Expres|
|000002c0| 73 69 6f 6e 20 73 74 61 | 74 65 6d 65 6e 74 73 20 |sion sta|tements |
|000002d0| 61 72 65 20 75 73 65 64 | 20 28 6d 6f 73 74 6c 79 |are used| (mostly|
|000002e0| 20 69 6e 74 65 72 61 63 | 74 69 76 65 6c 79 29 20 | interac|tively) |
|000002f0| 74 6f 20 63 6f 6d 70 75 | 74 65 20 61 6e 64 0d 77 |to compu|te and.w|
|00000300| 72 69 74 65 20 61 20 76 | 61 6c 75 65 2c 20 6f 72 |rite a v|alue, or|
|00000310| 20 28 75 73 75 61 6c 6c | 79 29 20 74 6f 20 63 61 | (usuall|y) to ca|
|00000320| 6c 6c 20 61 20 70 72 6f | 63 65 64 75 72 65 20 28 |ll a pro|cedure (|
|00000330| 61 20 66 75 6e 63 74 69 | 6f 6e 20 74 68 61 74 0d |a functi|on that.|
|00000340| 72 65 74 75 72 6e 73 20 | 6e 6f 20 6d 65 61 6e 69 |returns |no meani|
|00000350| 6e 67 66 75 6c 20 72 65 | 73 75 6c 74 3b 20 69 6e |ngful re|sult; in|
|00000360| 20 50 79 74 68 6f 6e 2c | 20 70 72 6f 63 65 64 75 | Python,| procedu|
|00000370| 72 65 73 20 72 65 74 75 | 72 6e 20 74 68 65 20 76 |res retu|rn the v|
|00000380| 61 6c 75 65 0d 5c 76 65 | 72 62 40 4e 6f 6e 65 40 |alue.\ve|rb@None@|
|00000390| 29 3a 0d 0d 5c 62 65 67 | 69 6e 7b 76 65 72 62 61 |):..\beg|in{verba|
|000003a0| 74 69 6d 7d 0d 65 78 70 | 72 65 73 73 69 6f 6e 5f |tim}.exp|ression_|
|000003b0| 73 74 6d 74 3a 20 63 6f | 6e 64 69 74 69 6f 6e 5f |stmt: co|ndition_|
|000003c0| 6c 69 73 74 0d 5c 65 6e | 64 7b 76 65 72 62 61 74 |list.\en|d{verbat|
|000003d0| 69 6d 7d 0d 0d 41 6e 20 | 65 78 70 72 65 73 73 69 |im}..An |expressi|
|000003e0| 6f 6e 20 73 74 61 74 65 | 6d 65 6e 74 20 65 76 61 |on state|ment eva|
|000003f0| 6c 75 61 74 65 73 20 74 | 68 65 20 63 6f 6e 64 69 |luates t|he condi|
|00000400| 74 69 6f 6e 20 6c 69 73 | 74 20 28 77 68 69 63 68 |tion lis|t (which|
|00000410| 20 6d 61 79 20 62 65 20 | 61 0d 73 69 6e 67 6c 65 | may be |a.single|
|00000420| 20 63 6f 6e 64 69 74 69 | 6f 6e 29 2e 0d 5c 69 6e | conditi|on)..\in|
|00000430| 64 65 78 69 69 7b 65 78 | 70 72 65 73 73 69 6f 6e |dexii{ex|pression|
|00000440| 7d 7b 6c 69 73 74 7d 0d | 0d 49 6e 20 69 6e 74 65 |}{list}.|.In inte|
|00000450| 72 61 63 74 69 76 65 20 | 6d 6f 64 65 2c 20 69 66 |ractive |mode, if|
|00000460| 20 74 68 65 20 76 61 6c | 75 65 20 69 73 20 6e 6f | the val|ue is no|
|00000470| 74 20 5c 76 65 72 62 40 | 4e 6f 6e 65 40 2c 20 69 |t \verb@|None@, i|
|00000480| 74 20 69 73 20 63 6f 6e | 76 65 72 74 65 64 0d 74 |t is con|verted.t|
|00000490| 6f 20 61 20 73 74 72 69 | 6e 67 20 75 73 69 6e 67 |o a stri|ng using|
|000004a0| 20 74 68 65 20 72 75 6c | 65 73 20 66 6f 72 20 73 | the rul|es for s|
|000004b0| 74 72 69 6e 67 20 63 6f | 6e 76 65 72 73 69 6f 6e |tring co|nversion|
|000004c0| 73 20 28 65 78 70 72 65 | 73 73 69 6f 6e 73 20 69 |s (expre|ssions i|
|000004d0| 6e 0d 72 65 76 65 72 73 | 65 20 71 75 6f 74 65 73 |n.revers|e quotes|
|000004e0| 29 2c 20 61 6e 64 20 74 | 68 65 20 72 65 73 75 6c |), and t|he resul|
|000004f0| 74 69 6e 67 20 73 74 72 | 69 6e 67 20 69 73 20 77 |ting str|ing is w|
|00000500| 72 69 74 74 65 6e 20 74 | 6f 20 73 74 61 6e 64 61 |ritten t|o standa|
|00000510| 72 64 0d 6f 75 74 70 75 | 74 20 28 73 65 65 20 73 |rd.outpu|t (see s|
|00000520| 65 63 74 69 6f 6e 20 5c | 72 65 66 7b 70 72 69 6e |ection \|ref{prin|
|00000530| 74 7d 29 20 6f 6e 20 61 | 20 6c 69 6e 65 20 62 79 |t}) on a| line by|
|00000540| 20 69 74 73 65 6c 66 2e | 0d 28 54 68 65 20 65 78 | itself.|.(The ex|
|00000550| 63 65 70 74 69 6f 6e 20 | 66 6f 72 20 5c 76 65 72 |ception |for \ver|
|00000560| 62 40 4e 6f 6e 65 40 20 | 69 73 20 6d 61 64 65 20 |b@None@ |is made |
|00000570| 73 6f 20 74 68 61 74 20 | 70 72 6f 63 65 64 75 72 |so that |procedur|
|00000580| 65 20 63 61 6c 6c 73 2c | 20 77 68 69 63 68 0d 61 |e calls,| which.a|
|00000590| 72 65 20 73 79 6e 74 61 | 63 74 69 63 61 6c 6c 79 |re synta|ctically|
|000005a0| 20 65 71 75 69 76 61 6c | 65 6e 74 20 74 6f 20 65 | equival|ent to e|
|000005b0| 78 70 72 65 73 73 69 6f | 6e 73 2c 20 64 6f 20 6e |xpressio|ns, do n|
|000005c0| 6f 74 20 63 61 75 73 65 | 20 61 6e 79 20 6f 75 74 |ot cause| any out|
|000005d0| 70 75 74 2e 29 0d 5c 74 | 74 69 6e 64 65 78 7b 4e |put.).\t|tindex{N|
|000005e0| 6f 6e 65 7d 0d 5c 69 6e | 64 65 78 69 69 7b 73 74 |one}.\in|dexii{st|
|000005f0| 72 69 6e 67 7d 7b 63 6f | 6e 76 65 72 73 69 6f 6e |ring}{co|nversion|
|00000600| 7d 0d 5c 69 6e 64 65 78 | 7b 6f 75 74 70 75 74 7d |}.\index|{output}|
|00000610| 0d 5c 69 6e 64 65 78 69 | 69 7b 73 74 61 6e 64 61 |.\indexi|i{standa|
|00000620| 72 64 7d 7b 6f 75 74 70 | 75 74 7d 0d 5c 69 6e 64 |rd}{outp|ut}.\ind|
|00000630| 65 78 69 69 7b 77 72 69 | 74 69 6e 67 7d 7b 76 61 |exii{wri|ting}{va|
|00000640| 6c 75 65 73 7d 0d 5c 69 | 6e 64 65 78 69 69 7b 70 |lues}.\i|ndexii{p|
|00000650| 72 6f 63 65 64 75 72 65 | 7d 7b 63 61 6c 6c 7d 0d |rocedure|}{call}.|
|00000660| 0d 5c 73 65 63 74 69 6f | 6e 7b 41 73 73 69 67 6e |.\sectio|n{Assign|
|00000670| 6d 65 6e 74 20 73 74 61 | 74 65 6d 65 6e 74 73 7d |ment sta|tements}|
|00000680| 0d 5c 69 6e 64 65 78 69 | 69 7b 61 73 73 69 67 6e |.\indexi|i{assign|
|00000690| 6d 65 6e 74 7d 7b 73 74 | 61 74 65 6d 65 6e 74 7d |ment}{st|atement}|
|000006a0| 0d 0d 41 73 73 69 67 6e | 6d 65 6e 74 20 73 74 61 |..Assign|ment sta|
|000006b0| 74 65 6d 65 6e 74 73 20 | 61 72 65 20 75 73 65 64 |tements |are used|
|000006c0| 20 74 6f 20 28 72 65 29 | 62 69 6e 64 20 6e 61 6d | to (re)|bind nam|
|000006d0| 65 73 20 74 6f 20 76 61 | 6c 75 65 73 20 61 6e 64 |es to va|lues and|
|000006e0| 20 74 6f 0d 6d 6f 64 69 | 66 79 20 61 74 74 72 69 | to.modi|fy attri|
|000006f0| 62 75 74 65 73 20 6f 72 | 20 69 74 65 6d 73 20 6f |butes or| items o|
|00000700| 66 20 6d 75 74 61 62 6c | 65 20 6f 62 6a 65 63 74 |f mutabl|e object|
|00000710| 73 3a 0d 5c 69 6e 64 65 | 78 69 69 7b 62 69 6e 64 |s:.\inde|xii{bind|
|00000720| 69 6e 67 7d 7b 6e 61 6d | 65 7d 0d 5c 69 6e 64 65 |ing}{nam|e}.\inde|
|00000730| 78 69 69 7b 72 65 62 69 | 6e 64 69 6e 67 7d 7b 6e |xii{rebi|nding}{n|
|00000740| 61 6d 65 7d 0d 5c 6f 62 | 69 6e 64 65 78 7b 6d 75 |ame}.\ob|index{mu|
|00000750| 74 61 62 6c 65 7d 0d 5c | 69 6e 64 65 78 69 69 7b |table}.\|indexii{|
|00000760| 61 74 74 72 69 62 75 74 | 65 7d 7b 61 73 73 69 67 |attribut|e}{assig|
|00000770| 6e 6d 65 6e 74 7d 0d 0d | 5c 62 65 67 69 6e 7b 76 |nment}..|\begin{v|
|00000780| 65 72 62 61 74 69 6d 7d | 0d 61 73 73 69 67 6e 6d |erbatim}|.assignm|
|00000790| 65 6e 74 5f 73 74 6d 74 | 3a 20 28 74 61 72 67 65 |ent_stmt|: (targe|
|000007a0| 74 5f 6c 69 73 74 20 22 | 3d 22 29 2b 20 65 78 70 |t_list "|=")+ exp|
|000007b0| 72 65 73 73 69 6f 6e 5f | 6c 69 73 74 0d 74 61 72 |ression_|list.tar|
|000007c0| 67 65 74 5f 6c 69 73 74 | 3a 20 20 20 20 20 74 61 |get_list|: ta|
|000007d0| 72 67 65 74 20 28 22 2c | 22 20 74 61 72 67 65 74 |rget (",|" target|
|000007e0| 29 2a 20 5b 22 2c 22 5d | 0d 74 61 72 67 65 74 3a |)* [","]|.target:|
|000007f0| 20 20 20 20 20 20 20 20 | 20 20 69 64 65 6e 74 69 | | identi|
|00000800| 66 69 65 72 20 7c 20 22 | 28 22 20 74 61 72 67 65 |fier | "|(" targe|
|00000810| 74 5f 6c 69 73 74 20 22 | 29 22 20 7c 20 22 5b 22 |t_list "|)" | "["|
|00000820| 20 74 61 72 67 65 74 5f | 6c 69 73 74 20 22 5d 22 | target_|list "]"|
|00000830| 0d 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|00000840| 7c 20 61 74 74 72 69 62 | 75 74 65 72 65 66 20 7c || attrib|uteref ||
|00000850| 20 73 75 62 73 63 72 69 | 70 74 69 6f 6e 20 7c 20 | subscri|ption | |
|00000860| 73 6c 69 63 69 6e 67 0d | 5c 65 6e 64 7b 76 65 72 |slicing.|\end{ver|
|00000870| 62 61 74 69 6d 7d 0d 0d | 28 53 65 65 20 73 65 63 |batim}..|(See sec|
|00000880| 74 69 6f 6e 20 5c 72 65 | 66 7b 70 72 69 6d 61 72 |tion \re|f{primar|
|00000890| 69 65 73 7d 20 66 6f 72 | 20 74 68 65 20 73 79 6e |ies} for| the syn|
|000008a0| 74 61 78 20 64 65 66 69 | 6e 69 74 69 6f 6e 73 20 |tax defi|nitions |
|000008b0| 66 6f 72 20 74 68 65 20 | 6c 61 73 74 0d 74 68 72 |for the |last.thr|
|000008c0| 65 65 20 73 79 6d 62 6f | 6c 73 2e 29 0d 0d 41 6e |ee symbo|ls.)..An|
|000008d0| 20 61 73 73 69 67 6e 6d | 65 6e 74 20 73 74 61 74 | assignm|ent stat|
|000008e0| 65 6d 65 6e 74 20 65 76 | 61 6c 75 61 74 65 73 20 |ement ev|aluates |
|000008f0| 74 68 65 20 65 78 70 72 | 65 73 73 69 6f 6e 20 6c |the expr|ession l|
|00000900| 69 73 74 20 28 72 65 6d | 65 6d 62 65 72 20 74 68 |ist (rem|ember th|
|00000910| 61 74 0d 74 68 69 73 20 | 63 61 6e 20 62 65 20 61 |at.this |can be a|
|00000920| 20 73 69 6e 67 6c 65 20 | 65 78 70 72 65 73 73 69 | single |expressi|
|00000930| 6f 6e 20 6f 72 20 61 20 | 63 6f 6d 6d 61 2d 73 65 |on or a |comma-se|
|00000940| 70 61 72 61 74 65 64 20 | 6c 69 73 74 2c 20 74 68 |parated |list, th|
|00000950| 65 20 6c 61 74 74 65 72 | 0d 79 69 65 6c 64 69 6e |e latter|.yieldin|
|00000960| 67 20 61 20 74 75 70 6c | 65 29 20 61 6e 64 20 61 |g a tupl|e) and a|
|00000970| 73 73 69 67 6e 73 20 74 | 68 65 20 73 69 6e 67 6c |ssigns t|he singl|
|00000980| 65 20 72 65 73 75 6c 74 | 69 6e 67 20 6f 62 6a 65 |e result|ing obje|
|00000990| 63 74 20 74 6f 20 65 61 | 63 68 20 6f 66 0d 74 68 |ct to ea|ch of.th|
|000009a0| 65 20 74 61 72 67 65 74 | 20 6c 69 73 74 73 2c 20 |e target| lists, |
|000009b0| 66 72 6f 6d 20 6c 65 66 | 74 20 74 6f 20 72 69 67 |from lef|t to rig|
|000009c0| 68 74 2e 0d 5c 69 6e 64 | 65 78 69 69 7b 65 78 70 |ht..\ind|exii{exp|
|000009d0| 72 65 73 73 69 6f 6e 7d | 7b 6c 69 73 74 7d 0d 0d |ression}|{list}..|
|000009e0| 41 73 73 69 67 6e 6d 65 | 6e 74 20 69 73 20 64 65 |Assignme|nt is de|
|000009f0| 66 69 6e 65 64 20 72 65 | 63 75 72 73 69 76 65 6c |fined re|cursivel|
|00000a00| 79 20 64 65 70 65 6e 64 | 69 6e 67 20 6f 6e 20 74 |y depend|ing on t|
|00000a10| 68 65 20 66 6f 72 6d 20 | 6f 66 20 74 68 65 20 74 |he form |of the t|
|00000a20| 61 72 67 65 74 0d 28 6c | 69 73 74 29 2e 20 20 57 |arget.(l|ist). W|
|00000a30| 68 65 6e 20 61 20 74 61 | 72 67 65 74 20 69 73 20 |hen a ta|rget is |
|00000a40| 70 61 72 74 20 6f 66 20 | 61 20 6d 75 74 61 62 6c |part of |a mutabl|
|00000a50| 65 20 6f 62 6a 65 63 74 | 20 28 61 6e 20 61 74 74 |e object| (an att|
|00000a60| 72 69 62 75 74 65 0d 72 | 65 66 65 72 65 6e 63 65 |ribute.r|eference|
|00000a70| 2c 20 73 75 62 73 63 72 | 69 70 74 69 6f 6e 20 6f |, subscr|iption o|
|00000a80| 72 20 73 6c 69 63 69 6e | 67 29 2c 20 74 68 65 20 |r slicin|g), the |
|00000a90| 6d 75 74 61 62 6c 65 20 | 6f 62 6a 65 63 74 20 6d |mutable |object m|
|00000aa0| 75 73 74 0d 75 6c 74 69 | 6d 61 74 65 6c 79 20 70 |ust.ulti|mately p|
|00000ab0| 65 72 66 6f 72 6d 20 74 | 68 65 20 61 73 73 69 67 |erform t|he assig|
|00000ac0| 6e 6d 65 6e 74 20 61 6e | 64 20 64 65 63 69 64 65 |nment an|d decide|
|00000ad0| 20 61 62 6f 75 74 20 69 | 74 73 20 76 61 6c 69 64 | about i|ts valid|
|00000ae0| 69 74 79 2c 20 61 6e 64 | 0d 6d 61 79 20 72 61 69 |ity, and|.may rai|
|00000af0| 73 65 20 61 6e 20 65 78 | 63 65 70 74 69 6f 6e 20 |se an ex|ception |
|00000b00| 69 66 20 74 68 65 20 61 | 73 73 69 67 6e 6d 65 6e |if the a|ssignmen|
|00000b10| 74 20 69 73 20 75 6e 61 | 63 63 65 70 74 61 62 6c |t is una|cceptabl|
|00000b20| 65 2e 20 20 54 68 65 20 | 72 75 6c 65 73 0d 6f 62 |e. The |rules.ob|
|00000b30| 73 65 72 76 65 64 20 62 | 79 20 76 61 72 69 6f 75 |served b|y variou|
|00000b40| 73 20 74 79 70 65 73 20 | 61 6e 64 20 74 68 65 20 |s types |and the |
|00000b50| 65 78 63 65 70 74 69 6f | 6e 73 20 72 61 69 73 65 |exceptio|ns raise|
|00000b60| 64 20 61 72 65 20 67 69 | 76 65 6e 20 77 69 74 68 |d are gi|ven with|
|00000b70| 20 74 68 65 0d 64 65 66 | 69 6e 69 74 69 6f 6e 20 | the.def|inition |
|00000b80| 6f 66 20 74 68 65 20 6f | 62 6a 65 63 74 20 74 79 |of the o|bject ty|
|00000b90| 70 65 73 20 28 73 65 65 | 20 73 65 63 74 69 6f 6e |pes (see| section|
|00000ba0| 20 5c 72 65 66 7b 74 79 | 70 65 73 7d 29 2e 0d 5c | \ref{ty|pes})..\|
|00000bb0| 69 6e 64 65 78 7b 74 61 | 72 67 65 74 7d 0d 5c 69 |index{ta|rget}.\i|
|00000bc0| 6e 64 65 78 69 69 7b 74 | 61 72 67 65 74 7d 7b 6c |ndexii{t|arget}{l|
|00000bd0| 69 73 74 7d 0d 0d 41 73 | 73 69 67 6e 6d 65 6e 74 |ist}..As|signment|
|00000be0| 20 6f 66 20 61 6e 20 6f | 62 6a 65 63 74 20 74 6f | of an o|bject to|
|00000bf0| 20 61 20 74 61 72 67 65 | 74 20 6c 69 73 74 20 69 | a targe|t list i|
|00000c00| 73 20 72 65 63 75 72 73 | 69 76 65 6c 79 20 64 65 |s recurs|ively de|
|00000c10| 66 69 6e 65 64 20 61 73 | 0d 66 6f 6c 6c 6f 77 73 |fined as|.follows|
|00000c20| 2e 0d 5c 69 6e 64 65 78 | 69 69 69 7b 74 61 72 67 |..\index|iii{targ|
|00000c30| 65 74 7d 7b 6c 69 73 74 | 7d 7b 61 73 73 69 67 6e |et}{list|}{assign|
|00000c40| 6d 65 6e 74 7d 0d 0d 5c | 62 65 67 69 6e 7b 69 74 |ment}..\|begin{it|
|00000c50| 65 6d 69 7a 65 7d 0d 5c | 69 74 65 6d 0d 49 66 20 |emize}.\|item.If |
|00000c60| 74 68 65 20 74 61 72 67 | 65 74 20 6c 69 73 74 20 |the targ|et list |
|00000c70| 69 73 20 61 20 73 69 6e | 67 6c 65 20 74 61 72 67 |is a sin|gle targ|
|00000c80| 65 74 3a 20 74 68 65 20 | 6f 62 6a 65 63 74 20 69 |et: the |object i|
|00000c90| 73 20 61 73 73 69 67 6e | 65 64 20 74 6f 20 74 68 |s assign|ed to th|
|00000ca0| 61 74 0d 74 61 72 67 65 | 74 2e 0d 0d 5c 69 74 65 |at.targe|t...\ite|
|00000cb0| 6d 0d 49 66 20 74 68 65 | 20 74 61 72 67 65 74 20 |m.If the| target |
|00000cc0| 6c 69 73 74 20 69 73 20 | 61 20 63 6f 6d 6d 61 2d |list is |a comma-|
|00000cd0| 73 65 70 61 72 61 74 65 | 64 20 6c 69 73 74 20 6f |separate|d list o|
|00000ce0| 66 20 74 61 72 67 65 74 | 73 3a 20 74 68 65 20 6f |f target|s: the o|
|00000cf0| 62 6a 65 63 74 0d 6d 75 | 73 74 20 62 65 20 61 20 |bject.mu|st be a |
|00000d00| 74 75 70 6c 65 20 77 69 | 74 68 20 74 68 65 20 73 |tuple wi|th the s|
|00000d10| 61 6d 65 20 6e 75 6d 62 | 65 72 20 6f 66 20 69 74 |ame numb|er of it|
|00000d20| 65 6d 73 20 61 73 20 74 | 68 65 20 6c 69 73 74 20 |ems as t|he list |
|00000d30| 63 6f 6e 74 61 69 6e 73 | 0d 74 61 72 67 65 74 73 |contains|.targets|
|00000d40| 2c 20 61 6e 64 20 74 68 | 65 20 69 74 65 6d 73 20 |, and th|e items |
|00000d50| 61 72 65 20 61 73 73 69 | 67 6e 65 64 2c 20 66 72 |are assi|gned, fr|
|00000d60| 6f 6d 20 6c 65 66 74 20 | 74 6f 20 72 69 67 68 74 |om left |to right|
|00000d70| 2c 20 74 6f 20 74 68 65 | 0d 63 6f 72 72 65 73 70 |, to the|.corresp|
|00000d80| 6f 6e 64 69 6e 67 20 74 | 61 72 67 65 74 73 2e 0d |onding t|argets..|
|00000d90| 0d 5c 65 6e 64 7b 69 74 | 65 6d 69 7a 65 7d 0d 0d |.\end{it|emize}..|
|00000da0| 41 73 73 69 67 6e 6d 65 | 6e 74 20 6f 66 20 61 6e |Assignme|nt of an|
|00000db0| 20 6f 62 6a 65 63 74 20 | 74 6f 20 61 20 73 69 6e | object |to a sin|
|00000dc0| 67 6c 65 20 74 61 72 67 | 65 74 20 69 73 20 72 65 |gle targ|et is re|
|00000dd0| 63 75 72 73 69 76 65 6c | 79 20 64 65 66 69 6e 65 |cursivel|y define|
|00000de0| 64 20 61 73 0d 66 6f 6c | 6c 6f 77 73 2e 0d 0d 5c |d as.fol|lows...\|
|00000df0| 62 65 67 69 6e 7b 69 74 | 65 6d 69 7a 65 7d 20 25 |begin{it|emize} %|
|00000e00| 20 6e 65 73 74 65 64 0d | 0d 5c 69 74 65 6d 0d 49 | nested.|.\item.I|
|00000e10| 66 20 74 68 65 20 74 61 | 72 67 65 74 20 69 73 20 |f the ta|rget is |
|00000e20| 61 6e 20 69 64 65 6e 74 | 69 66 69 65 72 20 28 6e |an ident|ifier (n|
|00000e30| 61 6d 65 29 3a 0d 0d 5c | 62 65 67 69 6e 7b 69 74 |ame):..\|begin{it|
|00000e40| 65 6d 69 7a 65 7d 0d 0d | 5c 69 74 65 6d 0d 49 66 |emize}..|\item.If|
|00000e50| 20 74 68 65 20 6e 61 6d | 65 20 64 6f 65 73 20 6e | the nam|e does n|
|00000e60| 6f 74 20 6f 63 63 75 72 | 20 69 6e 20 61 20 5c 76 |ot occur| in a \v|
|00000e70| 65 72 62 40 67 6c 6f 62 | 61 6c 40 20 73 74 61 74 |erb@glob|al@ stat|
|00000e80| 65 6d 65 6e 74 20 69 6e | 20 74 68 65 20 63 75 72 |ement in| the cur|
|00000e90| 72 65 6e 74 0d 63 6f 64 | 65 20 62 6c 6f 63 6b 3a |rent.cod|e block:|
|00000ea0| 20 74 68 65 20 6e 61 6d | 65 20 69 73 20 62 6f 75 | the nam|e is bou|
|00000eb0| 6e 64 20 74 6f 20 74 68 | 65 20 6f 62 6a 65 63 74 |nd to th|e object|
|00000ec0| 20 69 6e 20 74 68 65 20 | 63 75 72 72 65 6e 74 20 | in the |current |
|00000ed0| 6c 6f 63 61 6c 20 6e 61 | 6d 65 0d 73 70 61 63 65 |local na|me.space|
|00000ee0| 2e 0d 5c 73 74 69 6e 64 | 65 78 7b 67 6c 6f 62 61 |..\stind|ex{globa|
|00000ef0| 6c 7d 0d 0d 5c 69 74 65 | 6d 0d 4f 74 68 65 72 77 |l}..\ite|m.Otherw|
|00000f00| 69 73 65 3a 20 74 68 65 | 20 6e 61 6d 65 20 69 73 |ise: the| name is|
|00000f10| 20 62 6f 75 6e 64 20 74 | 6f 20 74 68 65 20 6f 62 | bound t|o the ob|
|00000f20| 6a 65 63 74 20 69 6e 20 | 74 68 65 20 63 75 72 72 |ject in |the curr|
|00000f30| 65 6e 74 20 67 6c 6f 62 | 61 6c 20 6e 61 6d 65 0d |ent glob|al name.|
|00000f40| 73 70 61 63 65 2e 0d 0d | 5c 65 6e 64 7b 69 74 65 |space...|\end{ite|
|00000f50| 6d 69 7a 65 7d 20 25 20 | 6e 65 73 74 65 64 0d 0d |mize} % |nested..|
|00000f60| 54 68 65 20 6e 61 6d 65 | 20 69 73 20 72 65 62 6f |The name| is rebo|
|00000f70| 75 6e 64 20 69 66 20 69 | 74 20 77 61 73 20 61 6c |und if i|t was al|
|00000f80| 72 65 61 64 79 20 62 6f | 75 6e 64 2e 0d 0d 5c 69 |ready bo|und...\i|
|00000f90| 74 65 6d 0d 49 66 20 74 | 68 65 20 74 61 72 67 65 |tem.If t|he targe|
|00000fa0| 74 20 69 73 20 61 20 74 | 61 72 67 65 74 20 6c 69 |t is a t|arget li|
|00000fb0| 73 74 20 65 6e 63 6c 6f | 73 65 64 20 69 6e 20 70 |st enclo|sed in p|
|00000fc0| 61 72 65 6e 74 68 65 73 | 65 73 3a 20 74 68 65 20 |arenthes|es: the |
|00000fd0| 6f 62 6a 65 63 74 20 69 | 73 0d 61 73 73 69 67 6e |object i|s.assign|
|00000fe0| 65 64 20 74 6f 20 74 68 | 61 74 20 74 61 72 67 65 |ed to th|at targe|
|00000ff0| 74 20 6c 69 73 74 20 61 | 73 20 64 65 73 63 72 69 |t list a|s descri|
|00001000| 62 65 64 20 61 62 6f 76 | 65 2e 0d 0d 5c 69 74 65 |bed abov|e...\ite|
|00001010| 6d 0d 49 66 20 74 68 65 | 20 74 61 72 67 65 74 20 |m.If the| target |
|00001020| 69 73 20 61 20 74 61 72 | 67 65 74 20 6c 69 73 74 |is a tar|get list|
|00001030| 20 65 6e 63 6c 6f 73 65 | 64 20 69 6e 20 73 71 75 | enclose|d in squ|
|00001040| 61 72 65 20 62 72 61 63 | 6b 65 74 73 3a 20 74 68 |are brac|kets: th|
|00001050| 65 20 6f 62 6a 65 63 74 | 0d 6d 75 73 74 20 62 65 |e object|.must be|
|00001060| 20 61 20 6c 69 73 74 20 | 77 69 74 68 20 74 68 65 | a list |with the|
|00001070| 20 73 61 6d 65 20 6e 75 | 6d 62 65 72 20 6f 66 20 | same nu|mber of |
|00001080| 69 74 65 6d 73 20 61 73 | 20 74 68 65 20 74 61 72 |items as| the tar|
|00001090| 67 65 74 20 6c 69 73 74 | 0d 63 6f 6e 74 61 69 6e |get list|.contain|
|000010a0| 73 20 74 61 72 67 65 74 | 73 2c 20 61 6e 64 20 69 |s target|s, and i|
|000010b0| 74 73 20 69 74 65 6d 73 | 20 61 72 65 20 61 73 73 |ts items| are ass|
|000010c0| 69 67 6e 65 64 2c 20 66 | 72 6f 6d 20 6c 65 66 74 |igned, f|rom left|
|000010d0| 20 74 6f 20 72 69 67 68 | 74 2c 20 74 6f 0d 74 68 | to righ|t, to.th|
|000010e0| 65 20 63 6f 72 72 65 73 | 70 6f 6e 64 69 6e 67 20 |e corres|ponding |
|000010f0| 74 61 72 67 65 74 73 2e | 0d 0d 5c 69 74 65 6d 0d |targets.|..\item.|
|00001100| 49 66 20 74 68 65 20 74 | 61 72 67 65 74 20 69 73 |If the t|arget is|
|00001110| 20 61 6e 20 61 74 74 72 | 69 62 75 74 65 20 72 65 | an attr|ibute re|
|00001120| 66 65 72 65 6e 63 65 3a | 20 54 68 65 20 70 72 69 |ference:| The pri|
|00001130| 6d 61 72 79 20 65 78 70 | 72 65 73 73 69 6f 6e 20 |mary exp|ression |
|00001140| 69 6e 20 74 68 65 0d 72 | 65 66 65 72 65 6e 63 65 |in the.r|eference|
|00001150| 20 69 73 20 65 76 61 6c | 75 61 74 65 64 2e 20 20 | is eval|uated. |
|00001160| 49 74 20 73 68 6f 75 6c | 64 20 79 69 65 6c 64 20 |It shoul|d yield |
|00001170| 61 6e 20 6f 62 6a 65 63 | 74 20 77 69 74 68 20 61 |an objec|t with a|
|00001180| 73 73 69 67 6e 61 62 6c | 65 0d 61 74 74 72 69 62 |ssignabl|e.attrib|
|00001190| 75 74 65 73 3b 20 69 66 | 20 74 68 69 73 20 69 73 |utes; if| this is|
|000011a0| 20 6e 6f 74 20 74 68 65 | 20 63 61 73 65 2c 20 5c | not the| case, \|
|000011b0| 76 65 72 62 40 54 79 70 | 65 45 72 72 6f 72 40 20 |verb@Typ|eError@ |
|000011c0| 69 73 20 72 61 69 73 65 | 64 2e 20 20 54 68 61 74 |is raise|d. That|
|000011d0| 0d 6f 62 6a 65 63 74 20 | 69 73 20 74 68 65 6e 20 |.object |is then |
|000011e0| 61 73 6b 65 64 20 74 6f | 20 61 73 73 69 67 6e 20 |asked to| assign |
|000011f0| 74 68 65 20 61 73 73 69 | 67 6e 65 64 20 6f 62 6a |the assi|gned obj|
|00001200| 65 63 74 20 74 6f 20 74 | 68 65 20 67 69 76 65 6e |ect to t|he given|
|00001210| 0d 61 74 74 72 69 62 75 | 74 65 3b 20 69 66 20 69 |.attribu|te; if i|
|00001220| 74 20 63 61 6e 6e 6f 74 | 20 70 65 72 66 6f 72 6d |t cannot| perform|
|00001230| 20 74 68 65 20 61 73 73 | 69 67 6e 6d 65 6e 74 2c | the ass|ignment,|
|00001240| 20 69 74 20 72 61 69 73 | 65 73 20 61 6e 20 65 78 | it rais|es an ex|
|00001250| 63 65 70 74 69 6f 6e 0d | 28 75 73 75 61 6c 6c 79 |ception.|(usually|
|00001260| 20 62 75 74 20 6e 6f 74 | 20 6e 65 63 65 73 73 61 | but not| necessa|
|00001270| 72 69 6c 79 20 5c 76 65 | 72 62 40 41 74 74 72 69 |rily \ve|rb@Attri|
|00001280| 62 75 74 65 45 72 72 6f | 72 40 29 2e 0d 5c 69 6e |buteErro|r@)..\in|
|00001290| 64 65 78 69 69 7b 61 74 | 74 72 69 62 75 74 65 7d |dexii{at|tribute}|
|000012a0| 7b 61 73 73 69 67 6e 6d | 65 6e 74 7d 0d 0d 5c 69 |{assignm|ent}..\i|
|000012b0| 74 65 6d 0d 49 66 20 74 | 68 65 20 74 61 72 67 65 |tem.If t|he targe|
|000012c0| 74 20 69 73 20 61 20 73 | 75 62 73 63 72 69 70 74 |t is a s|ubscript|
|000012d0| 69 6f 6e 3a 20 54 68 65 | 20 70 72 69 6d 61 72 79 |ion: The| primary|
|000012e0| 20 65 78 70 72 65 73 73 | 69 6f 6e 20 69 6e 20 74 | express|ion in t|
|000012f0| 68 65 0d 72 65 66 65 72 | 65 6e 63 65 20 69 73 20 |he.refer|ence is |
|00001300| 65 76 61 6c 75 61 74 65 | 64 2e 20 20 49 74 20 73 |evaluate|d. It s|
|00001310| 68 6f 75 6c 64 20 79 69 | 65 6c 64 20 65 69 74 68 |hould yi|eld eith|
|00001320| 65 72 20 61 20 6d 75 74 | 61 62 6c 65 20 73 65 71 |er a mut|able seq|
|00001330| 75 65 6e 63 65 0d 28 6c | 69 73 74 29 20 6f 62 6a |uence.(l|ist) obj|
|00001340| 65 63 74 20 6f 72 20 61 | 20 6d 61 70 70 69 6e 67 |ect or a| mapping|
|00001350| 20 28 64 69 63 74 69 6f | 6e 61 72 79 29 20 6f 62 | (dictio|nary) ob|
|00001360| 6a 65 63 74 2e 20 20 4e | 65 78 74 2c 20 74 68 65 |ject. N|ext, the|
|00001370| 20 73 75 62 73 63 72 69 | 70 74 0d 65 78 70 72 65 | subscri|pt.expre|
|00001380| 73 73 69 6f 6e 20 69 73 | 20 65 76 61 6c 75 61 74 |ssion is| evaluat|
|00001390| 65 64 2e 0d 5c 69 6e 64 | 65 78 69 69 7b 73 75 62 |ed..\ind|exii{sub|
|000013a0| 73 63 72 69 70 74 69 6f | 6e 7d 7b 61 73 73 69 67 |scriptio|n}{assig|
|000013b0| 6e 6d 65 6e 74 7d 0d 5c | 6f 62 69 6e 64 65 78 7b |nment}.\|obindex{|
|000013c0| 6d 75 74 61 62 6c 65 7d | 0d 0d 49 66 20 74 68 65 |mutable}|..If the|
|000013d0| 20 70 72 69 6d 61 72 79 | 20 69 73 20 61 20 6d 75 | primary| is a mu|
|000013e0| 74 61 62 6c 65 20 73 65 | 71 75 65 6e 63 65 20 6f |table se|quence o|
|000013f0| 62 6a 65 63 74 20 28 61 | 20 6c 69 73 74 29 2c 20 |bject (a| list), |
|00001400| 74 68 65 20 73 75 62 73 | 63 72 69 70 74 0d 6d 75 |the subs|cript.mu|
|00001410| 73 74 20 79 69 65 6c 64 | 20 61 20 70 6c 61 69 6e |st yield| a plain|
|00001420| 20 69 6e 74 65 67 65 72 | 2e 20 20 49 66 20 69 74 | integer|. If it|
|00001430| 20 69 73 20 6e 65 67 61 | 74 69 76 65 2c 20 74 68 | is nega|tive, th|
|00001440| 65 20 73 65 71 75 65 6e | 63 65 27 73 20 6c 65 6e |e sequen|ce's len|
|00001450| 67 74 68 0d 69 73 20 61 | 64 64 65 64 20 74 6f 20 |gth.is a|dded to |
|00001460| 69 74 2e 20 20 54 68 65 | 20 72 65 73 75 6c 74 69 |it. The| resulti|
|00001470| 6e 67 20 76 61 6c 75 65 | 20 6d 75 73 74 20 62 65 |ng value| must be|
|00001480| 20 61 20 6e 6f 6e 6e 65 | 67 61 74 69 76 65 20 69 | a nonne|gative i|
|00001490| 6e 74 65 67 65 72 0d 6c | 65 73 73 20 74 68 61 6e |nteger.l|ess than|
|000014a0| 20 74 68 65 20 73 65 71 | 75 65 6e 63 65 27 73 20 | the seq|uence's |
|000014b0| 6c 65 6e 67 74 68 2c 20 | 61 6e 64 20 74 68 65 20 |length, |and the |
|000014c0| 73 65 71 75 65 6e 63 65 | 20 69 73 20 61 73 6b 65 |sequence| is aske|
|000014d0| 64 20 74 6f 20 61 73 73 | 69 67 6e 0d 74 68 65 20 |d to ass|ign.the |
|000014e0| 61 73 73 69 67 6e 65 64 | 20 6f 62 6a 65 63 74 20 |assigned| object |
|000014f0| 74 6f 20 69 74 73 20 69 | 74 65 6d 20 77 69 74 68 |to its i|tem with|
|00001500| 20 74 68 61 74 20 69 6e | 64 65 78 2e 20 20 49 66 | that in|dex. If|
|00001510| 20 74 68 65 20 69 6e 64 | 65 78 20 69 73 20 6f 75 | the ind|ex is ou|
|00001520| 74 0d 6f 66 20 72 61 6e | 67 65 2c 20 5c 76 65 72 |t.of ran|ge, \ver|
|00001530| 62 40 49 6e 64 65 78 45 | 72 72 6f 72 40 20 69 73 |b@IndexE|rror@ is|
|00001540| 20 72 61 69 73 65 64 20 | 28 61 73 73 69 67 6e 6d | raised |(assignm|
|00001550| 65 6e 74 20 74 6f 20 61 | 20 73 75 62 73 63 72 69 |ent to a| subscri|
|00001560| 70 74 65 64 0d 73 65 71 | 75 65 6e 63 65 20 63 61 |pted.seq|uence ca|
|00001570| 6e 6e 6f 74 20 61 64 64 | 20 6e 65 77 20 69 74 65 |nnot add| new ite|
|00001580| 6d 73 20 74 6f 20 61 20 | 6c 69 73 74 29 2e 0d 5c |ms to a |list)..\|
|00001590| 6f 62 69 6e 64 65 78 7b | 73 65 71 75 65 6e 63 65 |obindex{|sequence|
|000015a0| 7d 0d 5c 6f 62 69 6e 64 | 65 78 7b 6c 69 73 74 7d |}.\obind|ex{list}|
|000015b0| 0d 0d 49 66 20 74 68 65 | 20 70 72 69 6d 61 72 79 |..If the| primary|
|000015c0| 20 69 73 20 61 20 6d 61 | 70 70 69 6e 67 20 28 64 | is a ma|pping (d|
|000015d0| 69 63 74 69 6f 6e 61 72 | 79 29 20 6f 62 6a 65 63 |ictionar|y) objec|
|000015e0| 74 2c 20 74 68 65 20 73 | 75 62 73 63 72 69 70 74 |t, the s|ubscript|
|000015f0| 20 6d 75 73 74 0d 68 61 | 76 65 20 61 20 74 79 70 | must.ha|ve a typ|
|00001600| 65 20 63 6f 6d 70 61 74 | 69 62 6c 65 20 77 69 74 |e compat|ible wit|
|00001610| 68 20 74 68 65 20 6d 61 | 70 70 69 6e 67 27 73 20 |h the ma|pping's |
|00001620| 6b 65 79 20 74 79 70 65 | 2c 20 61 6e 64 20 74 68 |key type|, and th|
|00001630| 65 20 6d 61 70 70 69 6e | 67 20 69 73 0d 74 68 65 |e mappin|g is.the|
|00001640| 6e 20 61 73 6b 65 64 20 | 74 6f 20 63 72 65 61 74 |n asked |to creat|
|00001650| 65 20 61 20 6b 65 79 2f | 64 61 74 75 6d 20 70 61 |e a key/|datum pa|
|00001660| 69 72 20 77 68 69 63 68 | 20 6d 61 70 73 20 74 68 |ir which| maps th|
|00001670| 65 20 73 75 62 73 63 72 | 69 70 74 20 74 6f 0d 74 |e subscr|ipt to.t|
|00001680| 68 65 20 61 73 73 69 67 | 6e 65 64 20 6f 62 6a 65 |he assig|ned obje|
|00001690| 63 74 2e 20 20 54 68 69 | 73 20 63 61 6e 20 65 69 |ct. Thi|s can ei|
|000016a0| 74 68 65 72 20 72 65 70 | 6c 61 63 65 20 61 6e 20 |ther rep|lace an |
|000016b0| 65 78 69 73 74 69 6e 67 | 20 6b 65 79 2f 76 61 6c |existing| key/val|
|000016c0| 75 65 0d 70 61 69 72 20 | 77 69 74 68 20 74 68 65 |ue.pair |with the|
|000016d0| 20 73 61 6d 65 20 6b 65 | 79 20 76 61 6c 75 65 2c | same ke|y value,|
|000016e0| 20 6f 72 20 69 6e 73 65 | 72 74 20 61 20 6e 65 77 | or inse|rt a new|
|000016f0| 20 6b 65 79 2f 76 61 6c | 75 65 20 70 61 69 72 20 | key/val|ue pair |
|00001700| 28 69 66 20 6e 6f 0d 6b | 65 79 20 77 69 74 68 20 |(if no.k|ey with |
|00001710| 74 68 65 20 73 61 6d 65 | 20 76 61 6c 75 65 20 65 |the same| value e|
|00001720| 78 69 73 74 65 64 29 2e | 0d 5c 6f 62 69 6e 64 65 |xisted).|.\obinde|
|00001730| 78 7b 6d 61 70 70 69 6e | 67 7d 0d 5c 6f 62 69 6e |x{mappin|g}.\obin|
|00001740| 64 65 78 7b 64 69 63 74 | 69 6f 6e 61 72 79 7d 0d |dex{dict|ionary}.|
|00001750| 0d 5c 69 74 65 6d 0d 49 | 66 20 74 68 65 20 74 61 |.\item.I|f the ta|
|00001760| 72 67 65 74 20 69 73 20 | 61 20 73 6c 69 63 69 6e |rget is |a slicin|
|00001770| 67 3a 20 54 68 65 20 70 | 72 69 6d 61 72 79 20 65 |g: The p|rimary e|
|00001780| 78 70 72 65 73 73 69 6f | 6e 20 69 6e 20 74 68 65 |xpressio|n in the|
|00001790| 20 72 65 66 65 72 65 6e | 63 65 20 69 73 0d 65 76 | referen|ce is.ev|
|000017a0| 61 6c 75 61 74 65 64 2e | 20 20 49 74 20 73 68 6f |aluated.| It sho|
|000017b0| 75 6c 64 20 79 69 65 6c | 64 20 61 20 6d 75 74 61 |uld yiel|d a muta|
|000017c0| 62 6c 65 20 73 65 71 75 | 65 6e 63 65 20 6f 62 6a |ble sequ|ence obj|
|000017d0| 65 63 74 20 28 65 2e 67 | 2e 20 61 20 6c 69 73 74 |ect (e.g|. a list|
|000017e0| 29 2e 20 20 54 68 65 0d | 61 73 73 69 67 6e 65 64 |). The.|assigned|
|000017f0| 20 6f 62 6a 65 63 74 20 | 73 68 6f 75 6c 64 20 62 | object |should b|
|00001800| 65 20 61 20 73 65 71 75 | 65 6e 63 65 20 6f 62 6a |e a sequ|ence obj|
|00001810| 65 63 74 20 6f 66 20 74 | 68 65 20 73 61 6d 65 20 |ect of t|he same |
|00001820| 74 79 70 65 2e 20 20 4e | 65 78 74 2c 0d 74 68 65 |type. N|ext,.the|
|00001830| 20 6c 6f 77 65 72 20 61 | 6e 64 20 75 70 70 65 72 | lower a|nd upper|
|00001840| 20 62 6f 75 6e 64 20 65 | 78 70 72 65 73 73 69 6f | bound e|xpressio|
|00001850| 6e 73 20 61 72 65 20 65 | 76 61 6c 75 61 74 65 64 |ns are e|valuated|
|00001860| 2c 20 69 6e 73 6f 66 61 | 72 20 74 68 65 79 20 61 |, insofa|r they a|
|00001870| 72 65 0d 70 72 65 73 65 | 6e 74 3b 20 64 65 66 61 |re.prese|nt; defa|
|00001880| 75 6c 74 73 20 61 72 65 | 20 7a 65 72 6f 20 61 6e |ults are| zero an|
|00001890| 64 20 74 68 65 20 73 65 | 71 75 65 6e 63 65 27 73 |d the se|quence's|
|000018a0| 20 6c 65 6e 67 74 68 2e | 20 20 54 68 65 20 62 6f | length.| The bo|
|000018b0| 75 6e 64 73 0d 73 68 6f | 75 6c 64 20 65 76 61 6c |unds.sho|uld eval|
|000018c0| 75 61 74 65 20 74 6f 20 | 28 73 6d 61 6c 6c 29 20 |uate to |(small) |
|000018d0| 69 6e 74 65 67 65 72 73 | 2e 20 20 49 66 20 65 69 |integers|. If ei|
|000018e0| 74 68 65 72 20 62 6f 75 | 6e 64 20 69 73 20 6e 65 |ther bou|nd is ne|
|000018f0| 67 61 74 69 76 65 2c 20 | 74 68 65 0d 73 65 71 75 |gative, |the.sequ|
|00001900| 65 6e 63 65 27 73 20 6c | 65 6e 67 74 68 20 69 73 |ence's l|ength is|
|00001910| 20 61 64 64 65 64 20 74 | 6f 20 69 74 2e 20 20 54 | added t|o it. T|
|00001920| 68 65 20 72 65 73 75 6c | 74 69 6e 67 20 62 6f 75 |he resul|ting bou|
|00001930| 6e 64 73 20 61 72 65 20 | 63 6c 69 70 70 65 64 20 |nds are |clipped |
|00001940| 74 6f 0d 6c 69 65 20 62 | 65 74 77 65 65 6e 20 7a |to.lie b|etween z|
|00001950| 65 72 6f 20 61 6e 64 20 | 74 68 65 20 73 65 71 75 |ero and |the sequ|
|00001960| 65 6e 63 65 27 73 20 6c | 65 6e 67 74 68 2c 20 69 |ence's l|ength, i|
|00001970| 6e 63 6c 75 73 69 76 65 | 2e 20 20 46 69 6e 61 6c |nclusive|. Final|
|00001980| 6c 79 2c 20 74 68 65 0d | 73 65 71 75 65 6e 63 65 |ly, the.|sequence|
|00001990| 20 6f 62 6a 65 63 74 20 | 69 73 20 61 73 6b 65 64 | object |is asked|
|000019a0| 20 74 6f 20 72 65 70 6c | 61 63 65 20 74 68 65 20 | to repl|ace the |
|000019b0| 73 6c 69 63 65 20 77 69 | 74 68 20 74 68 65 20 69 |slice wi|th the i|
|000019c0| 74 65 6d 73 20 6f 66 20 | 74 68 65 0d 61 73 73 69 |tems of |the.assi|
|000019d0| 67 6e 65 64 20 73 65 71 | 75 65 6e 63 65 2e 20 20 |gned seq|uence. |
|000019e0| 54 68 65 20 6c 65 6e 67 | 74 68 20 6f 66 20 74 68 |The leng|th of th|
|000019f0| 65 20 73 6c 69 63 65 20 | 6d 61 79 20 62 65 20 64 |e slice |may be d|
|00001a00| 69 66 66 65 72 65 6e 74 | 20 66 72 6f 6d 20 74 68 |ifferent| from th|
|00001a10| 65 0d 6c 65 6e 67 74 68 | 20 6f 66 20 74 68 65 20 |e.length| of the |
|00001a20| 61 73 73 69 67 6e 65 64 | 20 73 65 71 75 65 6e 63 |assigned| sequenc|
|00001a30| 65 2c 20 74 68 75 73 20 | 63 68 61 6e 67 69 6e 67 |e, thus |changing|
|00001a40| 20 74 68 65 20 6c 65 6e | 67 74 68 20 6f 66 20 74 | the len|gth of t|
|00001a50| 68 65 0d 74 61 72 67 65 | 74 20 73 65 71 75 65 6e |he.targe|t sequen|
|00001a60| 63 65 2c 20 69 66 20 74 | 68 65 20 6f 62 6a 65 63 |ce, if t|he objec|
|00001a70| 74 20 61 6c 6c 6f 77 73 | 20 69 74 2e 0d 5c 69 6e |t allows| it..\in|
|00001a80| 64 65 78 69 69 7b 73 6c | 69 63 69 6e 67 7d 7b 61 |dexii{sl|icing}{a|
|00001a90| 73 73 69 67 6e 6d 65 6e | 74 7d 0d 0d 5c 65 6e 64 |ssignmen|t}..\end|
|00001aa0| 7b 69 74 65 6d 69 7a 65 | 7d 0d 09 0d 28 49 6e 20 |{itemize|}...(In |
|00001ab0| 74 68 65 20 63 75 72 72 | 65 6e 74 20 69 6d 70 6c |the curr|ent impl|
|00001ac0| 65 6d 65 6e 74 61 74 69 | 6f 6e 2c 20 74 68 65 20 |ementati|on, the |
|00001ad0| 73 79 6e 74 61 78 20 66 | 6f 72 20 74 61 72 67 65 |syntax f|or targe|
|00001ae0| 74 73 20 69 73 20 74 61 | 6b 65 6e 0d 74 6f 20 62 |ts is ta|ken.to b|
|00001af0| 65 20 74 68 65 20 73 61 | 6d 65 20 61 73 20 66 6f |e the sa|me as fo|
|00001b00| 72 20 65 78 70 72 65 73 | 73 69 6f 6e 73 2c 20 61 |r expres|sions, a|
|00001b10| 6e 64 20 69 6e 76 61 6c | 69 64 20 73 79 6e 74 61 |nd inval|id synta|
|00001b20| 78 20 69 73 20 72 65 6a | 65 63 74 65 64 0d 64 75 |x is rej|ected.du|
|00001b30| 72 69 6e 67 20 74 68 65 | 20 63 6f 64 65 20 67 65 |ring the| code ge|
|00001b40| 6e 65 72 61 74 69 6f 6e | 20 70 68 61 73 65 2c 20 |neration| phase, |
|00001b50| 63 61 75 73 69 6e 67 20 | 6c 65 73 73 20 64 65 74 |causing |less det|
|00001b60| 61 69 6c 65 64 20 65 72 | 72 6f 72 0d 6d 65 73 73 |ailed er|ror.mess|
|00001b70| 61 67 65 73 2e 29 0d 0d | 57 41 52 4e 49 4e 47 3a |ages.)..|WARNING:|
|00001b80| 20 41 6c 74 68 6f 75 67 | 68 20 74 68 65 20 64 65 | Althoug|h the de|
|00001b90| 66 69 6e 69 74 69 6f 6e | 20 6f 66 20 61 73 73 69 |finition| of assi|
|00001ba0| 67 6e 6d 65 6e 74 20 69 | 6d 70 6c 69 65 73 20 74 |gnment i|mplies t|
|00001bb0| 68 61 74 20 6f 76 65 72 | 6c 61 70 73 0d 62 65 74 |hat over|laps.bet|
|00001bc0| 77 65 65 6e 20 74 68 65 | 20 6c 65 66 74 2d 68 61 |ween the| left-ha|
|00001bd0| 6e 64 20 73 69 64 65 20 | 61 6e 64 20 74 68 65 20 |nd side |and the |
|00001be0| 72 69 67 68 74 2d 68 61 | 6e 64 20 73 69 64 65 20 |right-ha|nd side |
|00001bf0| 61 72 65 20 60 73 61 66 | 65 27 20 28 65 2e 67 2e |are `saf|e' (e.g.|
|00001c00| 0d 5c 76 65 72 62 40 61 | 2c 20 62 20 3d 20 62 2c |.\verb@a|, b = b,|
|00001c10| 20 61 40 20 73 77 61 70 | 73 20 74 77 6f 20 76 61 | a@ swap|s two va|
|00001c20| 72 69 61 62 6c 65 73 29 | 2c 20 6f 76 65 72 6c 61 |riables)|, overla|
|00001c30| 70 73 20 77 69 74 68 69 | 6e 20 74 68 65 0d 63 6f |ps withi|n the.co|
|00001c40| 6c 6c 65 63 74 69 6f 6e | 20 6f 66 20 61 73 73 69 |llection| of assi|
|00001c50| 67 6e 65 64 2d 74 6f 20 | 76 61 72 69 61 62 6c 65 |gned-to |variable|
|00001c60| 73 20 61 72 65 20 6e 6f | 74 20 73 61 66 65 21 20 |s are no|t safe! |
|00001c70| 20 46 6f 72 20 69 6e 73 | 74 61 6e 63 65 2c 20 74 | For ins|tance, t|
|00001c80| 68 65 0d 66 6f 6c 6c 6f | 77 69 6e 67 20 70 72 6f |he.follo|wing pro|
|00001c90| 67 72 61 6d 20 70 72 69 | 6e 74 73 20 5c 63 6f 64 |gram pri|nts \cod|
|00001ca0| 65 40 5b 30 2c 20 32 5d | 40 3a 0d 0d 5c 62 65 67 |e@[0, 2]|@:..\beg|
|00001cb0| 69 6e 7b 76 65 72 62 61 | 74 69 6d 7d 0d 78 20 3d |in{verba|tim}.x =|
|00001cc0| 20 5b 30 2c 20 31 5d 0d | 69 20 3d 20 30 0d 69 2c | [0, 1].|i = 0.i,|
|00001cd0| 20 78 5b 69 5d 20 3d 20 | 31 2c 20 32 0d 70 72 69 | x[i] = |1, 2.pri|
|00001ce0| 6e 74 20 78 0d 5c 65 6e | 64 7b 76 65 72 62 61 74 |nt x.\en|d{verbat|
|00001cf0| 69 6d 7d 0d 0d 0d 5c 73 | 65 63 74 69 6f 6e 7b 54 |im}...\s|ection{T|
|00001d00| 68 65 20 7b 5c 74 74 20 | 70 61 73 73 7d 20 73 74 |he {\tt |pass} st|
|00001d10| 61 74 65 6d 65 6e 74 7d | 0d 5c 73 74 69 6e 64 65 |atement}|.\stinde|
|00001d20| 78 7b 70 61 73 73 7d 0d | 0d 5c 62 65 67 69 6e 7b |x{pass}.|.\begin{|
|00001d30| 76 65 72 62 61 74 69 6d | 7d 0d 70 61 73 73 5f 73 |verbatim|}.pass_s|
|00001d40| 74 6d 74 3a 20 20 20 20 | 20 20 22 70 61 73 73 22 |tmt: | "pass"|
|00001d50| 0d 5c 65 6e 64 7b 76 65 | 72 62 61 74 69 6d 7d 0d |.\end{ve|rbatim}.|
|00001d60| 0d 5c 76 65 72 62 40 70 | 61 73 73 40 20 69 73 20 |.\verb@p|ass@ is |
|00001d70| 61 20 6e 75 6c 6c 20 6f | 70 65 72 61 74 69 6f 6e |a null o|peration|
|00001d80| 20 2d 2d 2d 20 77 68 65 | 6e 20 69 74 20 69 73 20 | --- whe|n it is |
|00001d90| 65 78 65 63 75 74 65 64 | 2c 20 6e 6f 74 68 69 6e |executed|, nothin|
|00001da0| 67 0d 68 61 70 70 65 6e | 73 2e 20 20 49 74 20 69 |g.happen|s. It i|
|00001db0| 73 20 75 73 65 66 75 6c | 20 61 73 20 61 20 70 6c |s useful| as a pl|
|00001dc0| 61 63 65 68 6f 6c 64 65 | 72 20 77 68 65 6e 20 61 |aceholde|r when a|
|00001dd0| 20 73 74 61 74 65 6d 65 | 6e 74 20 69 73 0d 72 65 | stateme|nt is.re|
|00001de0| 71 75 69 72 65 64 20 73 | 79 6e 74 61 63 74 69 63 |quired s|yntactic|
|00001df0| 61 6c 6c 79 2c 20 62 75 | 74 20 6e 6f 20 63 6f 64 |ally, bu|t no cod|
|00001e00| 65 20 6e 65 65 64 73 20 | 74 6f 20 62 65 20 65 78 |e needs |to be ex|
|00001e10| 65 63 75 74 65 64 2c 20 | 66 6f 72 20 65 78 61 6d |ecuted, |for exam|
|00001e20| 70 6c 65 3a 0d 5c 69 6e | 64 65 78 69 69 7b 6e 75 |ple:.\in|dexii{nu|
|00001e30| 6c 6c 7d 7b 6f 70 65 72 | 61 74 69 6f 6e 7d 0d 0d |ll}{oper|ation}..|
|00001e40| 5c 62 65 67 69 6e 7b 76 | 65 72 62 61 74 69 6d 7d |\begin{v|erbatim}|
|00001e50| 0d 64 65 66 20 66 28 61 | 72 67 29 3a 20 70 61 73 |.def f(a|rg): pas|
|00001e60| 73 20 20 20 20 23 20 61 | 20 66 75 6e 63 74 69 6f |s # a| functio|
|00001e70| 6e 20 74 68 61 74 20 64 | 6f 65 73 20 6e 6f 74 68 |n that d|oes noth|
|00001e80| 69 6e 67 20 28 79 65 74 | 29 0d 0d 63 6c 61 73 73 |ing (yet|)..class|
|00001e90| 20 43 3a 20 70 61 73 73 | 20 20 20 20 20 20 20 23 | C: pass| #|
|00001ea0| 20 61 20 63 6c 61 73 73 | 20 77 69 74 68 20 6e 6f | a class| with no|
|00001eb0| 20 6d 65 74 68 6f 64 73 | 20 28 79 65 74 29 0d 5c | methods| (yet).\|
|00001ec0| 65 6e 64 7b 76 65 72 62 | 61 74 69 6d 7d 0d 0d 5c |end{verb|atim}..\|
|00001ed0| 73 65 63 74 69 6f 6e 7b | 54 68 65 20 7b 5c 74 74 |section{|The {\tt|
|00001ee0| 20 64 65 6c 7d 20 73 74 | 61 74 65 6d 65 6e 74 7d | del} st|atement}|
|00001ef0| 0d 5c 73 74 69 6e 64 65 | 78 7b 64 65 6c 7d 0d 0d |.\stinde|x{del}..|
|00001f00| 5c 62 65 67 69 6e 7b 76 | 65 72 62 61 74 69 6d 7d |\begin{v|erbatim}|
|00001f10| 0d 64 65 6c 5f 73 74 6d | 74 3a 20 20 20 20 20 20 |.del_stm|t: |
|00001f20| 20 22 64 65 6c 22 20 74 | 61 72 67 65 74 5f 6c 69 | "del" t|arget_li|
|00001f30| 73 74 0d 5c 65 6e 64 7b | 76 65 72 62 61 74 69 6d |st.\end{|verbatim|
|00001f40| 7d 0d 0d 44 65 6c 65 74 | 69 6f 6e 20 69 73 20 72 |}..Delet|ion is r|
|00001f50| 65 63 75 72 73 69 76 65 | 6c 79 20 64 65 66 69 6e |ecursive|ly defin|
|00001f60| 65 64 20 76 65 72 79 20 | 73 69 6d 69 6c 61 72 20 |ed very |similar |
|00001f70| 74 6f 20 74 68 65 20 77 | 61 79 20 61 73 73 69 67 |to the w|ay assig|
|00001f80| 6e 6d 65 6e 74 20 69 73 | 0d 64 65 66 69 6e 65 64 |nment is|.defined|
|00001f90| 2e 20 52 61 74 68 65 72 | 20 74 68 61 74 20 73 70 |. Rather| that sp|
|00001fa0| 65 6c 6c 69 6e 67 20 69 | 74 20 6f 75 74 20 69 6e |elling i|t out in|
|00001fb0| 20 66 75 6c 6c 20 64 65 | 74 61 69 6c 73 2c 20 68 | full de|tails, h|
|00001fc0| 65 72 65 20 61 72 65 20 | 73 6f 6d 65 0d 68 69 6e |ere are |some.hin|
|00001fd0| 74 73 2e 0d 5c 69 6e 64 | 65 78 69 69 7b 64 65 6c |ts..\ind|exii{del|
|00001fe0| 65 74 69 6f 6e 7d 7b 74 | 61 72 67 65 74 7d 0d 5c |etion}{t|arget}.\|
|00001ff0| 69 6e 64 65 78 69 69 69 | 7b 64 65 6c 65 74 69 6f |indexiii|{deletio|
|00002000| 6e 7d 7b 74 61 72 67 65 | 74 7d 7b 6c 69 73 74 7d |n}{targe|t}{list}|
|00002010| 0d 0d 44 65 6c 65 74 69 | 6f 6e 20 6f 66 20 61 20 |..Deleti|on of a |
|00002020| 74 61 72 67 65 74 20 6c | 69 73 74 20 72 65 63 75 |target l|ist recu|
|00002030| 72 73 69 76 65 6c 79 20 | 64 65 6c 65 74 65 73 20 |rsively |deletes |
|00002040| 65 61 63 68 20 74 61 72 | 67 65 74 2c 20 66 72 6f |each tar|get, fro|
|00002050| 6d 20 6c 65 66 74 0d 74 | 6f 20 72 69 67 68 74 2e |m left.t|o right.|
|00002060| 0d 0d 44 65 6c 65 74 69 | 6f 6e 20 6f 66 20 61 20 |..Deleti|on of a |
|00002070| 6e 61 6d 65 20 72 65 6d | 6f 76 65 73 20 74 68 65 |name rem|oves the|
|00002080| 20 62 69 6e 64 69 6e 67 | 20 6f 66 20 74 68 61 74 | binding| of that|
|00002090| 20 6e 61 6d 65 20 28 77 | 68 69 63 68 20 6d 75 73 | name (w|hich mus|
|000020a0| 74 20 65 78 69 73 74 29 | 0d 66 72 6f 6d 20 74 68 |t exist)|.from th|
|000020b0| 65 20 6c 6f 63 61 6c 20 | 6f 72 20 67 6c 6f 62 61 |e local |or globa|
|000020c0| 6c 20 6e 61 6d 65 20 73 | 70 61 63 65 2c 20 64 65 |l name s|pace, de|
|000020d0| 70 65 6e 64 69 6e 67 20 | 6f 6e 20 77 68 65 74 68 |pending |on wheth|
|000020e0| 65 72 20 74 68 65 20 6e | 61 6d 65 0d 6f 63 63 75 |er the n|ame.occu|
|000020f0| 72 73 20 69 6e 20 61 20 | 5c 76 65 72 62 40 67 6c |rs in a |\verb@gl|
|00002100| 6f 62 61 6c 40 20 73 74 | 61 74 65 6d 65 6e 74 20 |obal@ st|atement |
|00002110| 69 6e 20 74 68 65 20 73 | 61 6d 65 20 63 6f 64 65 |in the s|ame code|
|00002120| 20 62 6c 6f 63 6b 2e 0d | 5c 73 74 69 6e 64 65 78 | block..|\stindex|
|00002130| 7b 67 6c 6f 62 61 6c 7d | 0d 5c 69 6e 64 65 78 69 |{global}|.\indexi|
|00002140| 69 7b 75 6e 62 69 6e 64 | 69 6e 67 7d 7b 6e 61 6d |i{unbind|ing}{nam|
|00002150| 65 7d 0d 0d 44 65 6c 65 | 74 69 6f 6e 20 6f 66 20 |e}..Dele|tion of |
|00002160| 61 74 74 72 69 62 75 74 | 65 20 72 65 66 65 72 65 |attribut|e refere|
|00002170| 6e 63 65 73 2c 20 73 75 | 62 73 63 72 69 70 74 69 |nces, su|bscripti|
|00002180| 6f 6e 73 20 61 6e 64 20 | 73 6c 69 63 69 6e 67 73 |ons and |slicings|
|00002190| 0d 69 73 20 70 61 73 73 | 65 64 20 74 6f 20 74 68 |.is pass|ed to th|
|000021a0| 65 20 70 72 69 6d 61 72 | 79 20 6f 62 6a 65 63 74 |e primar|y object|
|000021b0| 20 69 6e 76 6f 6c 76 65 | 64 3b 20 64 65 6c 65 74 | involve|d; delet|
|000021c0| 69 6f 6e 20 6f 66 20 61 | 20 73 6c 69 63 69 6e 67 |ion of a| slicing|
|000021d0| 0d 69 73 20 69 6e 20 67 | 65 6e 65 72 61 6c 20 65 |.is in g|eneral e|
|000021e0| 71 75 69 76 61 6c 65 6e | 74 20 74 6f 20 61 73 73 |quivalen|t to ass|
|000021f0| 69 67 6e 6d 65 6e 74 20 | 6f 66 20 61 6e 20 65 6d |ignment |of an em|
|00002200| 70 74 79 20 73 6c 69 63 | 65 20 6f 66 20 74 68 65 |pty slic|e of the|
|00002210| 0d 72 69 67 68 74 20 74 | 79 70 65 20 28 62 75 74 |.right t|ype (but|
|00002220| 20 65 76 65 6e 20 74 68 | 69 73 20 69 73 20 64 65 | even th|is is de|
|00002230| 74 65 72 6d 69 6e 65 64 | 20 62 79 20 74 68 65 20 |termined| by the |
|00002240| 73 6c 69 63 65 64 20 6f | 62 6a 65 63 74 29 2e 0d |sliced o|bject)..|
|00002250| 5c 69 6e 64 65 78 69 69 | 7b 61 74 74 72 69 62 75 |\indexii|{attribu|
|00002260| 74 65 7d 7b 64 65 6c 65 | 74 69 6f 6e 7d 0d 0d 5c |te}{dele|tion}..\|
|00002270| 73 65 63 74 69 6f 6e 7b | 54 68 65 20 7b 5c 74 74 |section{|The {\tt|
|00002280| 20 70 72 69 6e 74 7d 20 | 73 74 61 74 65 6d 65 6e | print} |statemen|
|00002290| 74 7d 20 5c 6c 61 62 65 | 6c 7b 70 72 69 6e 74 7d |t} \labe|l{print}|
|000022a0| 0d 5c 73 74 69 6e 64 65 | 78 7b 70 72 69 6e 74 7d |.\stinde|x{print}|
|000022b0| 0d 0d 5c 62 65 67 69 6e | 7b 76 65 72 62 61 74 69 |..\begin|{verbati|
|000022c0| 6d 7d 0d 70 72 69 6e 74 | 5f 73 74 6d 74 3a 20 20 |m}.print|_stmt: |
|000022d0| 20 20 20 22 70 72 69 6e | 74 22 20 5b 20 63 6f 6e | "prin|t" [ con|
|000022e0| 64 69 74 69 6f 6e 20 28 | 22 2c 22 20 63 6f 6e 64 |dition (|"," cond|
|000022f0| 69 74 69 6f 6e 29 2a 20 | 5b 22 2c 22 5d 20 5d 0d |ition)* |[","] ].|
|00002300| 5c 65 6e 64 7b 76 65 72 | 62 61 74 69 6d 7d 0d 0d |\end{ver|batim}..|
|00002310| 5c 76 65 72 62 40 70 72 | 69 6e 74 40 20 65 76 61 |\verb@pr|int@ eva|
|00002320| 6c 75 61 74 65 73 20 65 | 61 63 68 20 63 6f 6e 64 |luates e|ach cond|
|00002330| 69 74 69 6f 6e 20 69 6e | 20 74 75 72 6e 20 61 6e |ition in| turn an|
|00002340| 64 20 77 72 69 74 65 73 | 20 74 68 65 20 72 65 73 |d writes| the res|
|00002350| 75 6c 74 69 6e 67 0d 6f | 62 6a 65 63 74 20 74 6f |ulting.o|bject to|
|00002360| 20 73 74 61 6e 64 61 72 | 64 20 6f 75 74 70 75 74 | standar|d output|
|00002370| 20 28 73 65 65 20 62 65 | 6c 6f 77 29 2e 20 20 49 | (see be|low). I|
|00002380| 66 20 61 6e 20 6f 62 6a | 65 63 74 20 69 73 20 6e |f an obj|ect is n|
|00002390| 6f 74 20 61 20 73 74 72 | 69 6e 67 2c 0d 69 74 20 |ot a str|ing,.it |
|000023a0| 69 73 20 66 69 72 73 74 | 20 63 6f 6e 76 65 72 74 |is first| convert|
|000023b0| 65 64 20 74 6f 20 61 20 | 73 74 72 69 6e 67 20 75 |ed to a |string u|
|000023c0| 73 69 6e 67 20 74 68 65 | 20 72 75 6c 65 73 20 66 |sing the| rules f|
|000023d0| 6f 72 20 73 74 72 69 6e | 67 0d 63 6f 6e 76 65 72 |or strin|g.conver|
|000023e0| 73 69 6f 6e 73 2e 20 20 | 54 68 65 20 28 72 65 73 |sions. |The (res|
|000023f0| 75 6c 74 69 6e 67 20 6f | 72 20 6f 72 69 67 69 6e |ulting o|r origin|
|00002400| 61 6c 29 20 73 74 72 69 | 6e 67 20 69 73 20 74 68 |al) stri|ng is th|
|00002410| 65 6e 20 77 72 69 74 74 | 65 6e 2e 20 20 41 0d 73 |en writt|en. A.s|
|00002420| 70 61 63 65 20 69 73 20 | 77 72 69 74 74 65 6e 20 |pace is |written |
|00002430| 62 65 66 6f 72 65 20 65 | 61 63 68 20 6f 62 6a 65 |before e|ach obje|
|00002440| 63 74 20 69 73 20 28 63 | 6f 6e 76 65 72 74 65 64 |ct is (c|onverted|
|00002450| 20 61 6e 64 29 20 77 72 | 69 74 74 65 6e 2c 20 75 | and) wr|itten, u|
|00002460| 6e 6c 65 73 73 0d 74 68 | 65 20 6f 75 74 70 75 74 |nless.th|e output|
|00002470| 20 73 79 73 74 65 6d 20 | 62 65 6c 69 65 76 65 73 | system |believes|
|00002480| 20 69 74 20 69 73 20 70 | 6f 73 69 74 69 6f 6e 65 | it is p|ositione|
|00002490| 64 20 61 74 20 74 68 65 | 20 62 65 67 69 6e 6e 69 |d at the| beginni|
|000024a0| 6e 67 20 6f 66 20 61 0d | 6c 69 6e 65 2e 20 20 54 |ng of a.|line. T|
|000024b0| 68 69 73 20 69 73 20 74 | 68 65 20 63 61 73 65 3a |his is t|he case:|
|000024c0| 20 28 31 29 20 77 68 65 | 6e 20 6e 6f 20 63 68 61 | (1) whe|n no cha|
|000024d0| 72 61 63 74 65 72 73 20 | 68 61 76 65 20 79 65 74 |racters |have yet|
|000024e0| 20 62 65 65 6e 20 77 72 | 69 74 74 65 6e 0d 74 6f | been wr|itten.to|
|000024f0| 20 73 74 61 6e 64 61 72 | 64 20 6f 75 74 70 75 74 | standar|d output|
|00002500| 3b 20 6f 72 20 28 32 29 | 20 77 68 65 6e 20 74 68 |; or (2)| when th|
|00002510| 65 20 6c 61 73 74 20 63 | 68 61 72 61 63 74 65 72 |e last c|haracter|
|00002520| 20 77 72 69 74 74 65 6e | 20 74 6f 20 73 74 61 6e | written| to stan|
|00002530| 64 61 72 64 0d 6f 75 74 | 70 75 74 20 69 73 20 5c |dard.out|put is \|
|00002540| 76 65 72 62 2f 5c 6e 2f | 3b 20 6f 72 20 28 33 29 |verb/\n/|; or (3)|
|00002550| 20 77 68 65 6e 20 74 68 | 65 20 6c 61 73 74 20 77 | when th|e last w|
|00002560| 72 69 74 65 20 6f 70 65 | 72 61 74 69 6f 6e 20 6f |rite ope|ration o|
|00002570| 6e 20 73 74 61 6e 64 61 | 72 64 0d 6f 75 74 70 75 |n standa|rd.outpu|
|00002580| 74 20 77 61 73 20 6e 6f | 74 20 61 20 5c 76 65 72 |t was no|t a \ver|
|00002590| 62 40 70 72 69 6e 74 40 | 20 73 74 61 74 65 6d 65 |b@print@| stateme|
|000025a0| 6e 74 2e 20 20 28 49 6e | 20 73 6f 6d 65 20 63 61 |nt. (In| some ca|
|000025b0| 73 65 73 20 69 74 20 6d | 61 79 20 62 65 0d 66 75 |ses it m|ay be.fu|
|000025c0| 6e 63 74 69 6f 6e 61 6c | 20 74 6f 20 77 72 69 74 |nctional| to writ|
|000025d0| 65 20 61 6e 20 65 6d 70 | 74 79 20 73 74 72 69 6e |e an emp|ty strin|
|000025e0| 67 20 74 6f 20 73 74 61 | 6e 64 61 72 64 20 6f 75 |g to sta|ndard ou|
|000025f0| 74 70 75 74 20 66 6f 72 | 20 74 68 69 73 0d 72 65 |tput for| this.re|
|00002600| 61 73 6f 6e 2e 29 0d 5c | 69 6e 64 65 78 7b 6f 75 |ason.).\|index{ou|
|00002610| 74 70 75 74 7d 0d 5c 69 | 6e 64 65 78 69 69 7b 77 |tput}.\i|ndexii{w|
|00002620| 72 69 74 69 6e 67 7d 7b | 76 61 6c 75 65 73 7d 0d |riting}{|values}.|
|00002630| 0d 41 20 5c 76 65 72 62 | 2f 22 5c 6e 22 2f 20 63 |.A \verb|/"\n"/ c|
|00002640| 68 61 72 61 63 74 65 72 | 20 69 73 20 77 72 69 74 |haracter| is writ|
|00002650| 74 65 6e 20 61 74 20 74 | 68 65 20 65 6e 64 2c 20 |ten at t|he end, |
|00002660| 75 6e 6c 65 73 73 20 74 | 68 65 20 5c 76 65 72 62 |unless t|he \verb|
|00002670| 40 70 72 69 6e 74 40 0d | 73 74 61 74 65 6d 65 6e |@print@.|statemen|
|00002680| 74 20 65 6e 64 73 20 77 | 69 74 68 20 61 20 63 6f |t ends w|ith a co|
|00002690| 6d 6d 61 2e 20 20 54 68 | 69 73 20 69 73 20 74 68 |mma. Th|is is th|
|000026a0| 65 20 6f 6e 6c 79 20 61 | 63 74 69 6f 6e 20 69 66 |e only a|ction if|
|000026b0| 20 74 68 65 20 73 74 61 | 74 65 6d 65 6e 74 0d 63 | the sta|tement.c|
|000026c0| 6f 6e 74 61 69 6e 73 20 | 6a 75 73 74 20 74 68 65 |ontains |just the|
|000026d0| 20 6b 65 79 77 6f 72 64 | 20 5c 76 65 72 62 40 70 | keyword| \verb@p|
|000026e0| 72 69 6e 74 40 2e 0d 5c | 69 6e 64 65 78 69 69 7b |rint@..\|indexii{|
|000026f0| 74 72 61 69 6c 69 6e 67 | 7d 7b 63 6f 6d 6d 61 7d |trailing|}{comma}|
|00002700| 0d 5c 69 6e 64 65 78 69 | 69 7b 6e 65 77 6c 69 6e |.\indexi|i{newlin|
|00002710| 65 7d 7b 73 75 70 70 72 | 65 73 73 69 6f 6e 7d 0d |e}{suppr|ession}.|
|00002720| 0d 53 74 61 6e 64 61 72 | 64 20 6f 75 74 70 75 74 |.Standar|d output|
|00002730| 20 69 73 20 64 65 66 69 | 6e 65 64 20 61 73 20 74 | is defi|ned as t|
|00002740| 68 65 20 66 69 6c 65 20 | 6f 62 6a 65 63 74 20 6e |he file |object n|
|00002750| 61 6d 65 64 20 5c 76 65 | 72 62 40 73 74 64 6f 75 |amed \ve|rb@stdou|
|00002760| 74 40 0d 69 6e 20 74 68 | 65 20 62 75 69 6c 74 2d |t@.in th|e built-|
|00002770| 69 6e 20 6d 6f 64 75 6c | 65 20 5c 76 65 72 62 40 |in modul|e \verb@|
|00002780| 73 79 73 40 2e 20 20 49 | 66 20 6e 6f 20 73 75 63 |sys@. I|f no suc|
|00002790| 68 20 6f 62 6a 65 63 74 | 20 65 78 69 73 74 73 2c |h object| exists,|
|000027a0| 0d 6f 72 20 69 66 20 69 | 74 20 69 73 20 6e 6f 74 |.or if i|t is not|
|000027b0| 20 61 20 77 72 69 74 61 | 62 6c 65 20 66 69 6c 65 | a writa|ble file|
|000027c0| 2c 20 61 20 5c 76 65 72 | 62 40 52 75 6e 74 69 6d |, a \ver|b@Runtim|
|000027d0| 65 45 72 72 6f 72 40 20 | 65 78 63 65 70 74 69 6f |eError@ |exceptio|
|000027e0| 6e 20 69 73 20 72 61 69 | 73 65 64 2e 0d 28 54 68 |n is rai|sed..(Th|
|000027f0| 65 20 6f 72 69 67 69 6e | 61 6c 20 69 6d 70 6c 65 |e origin|al imple|
|00002800| 6d 65 6e 74 61 74 69 6f | 6e 20 61 74 74 65 6d 70 |mentatio|n attemp|
|00002810| 74 73 20 74 6f 20 77 72 | 69 74 65 20 74 6f 20 74 |ts to wr|ite to t|
|00002820| 68 65 20 73 79 73 74 65 | 6d 27 73 20 6f 72 69 67 |he syste|m's orig|
|00002830| 69 6e 61 6c 0d 73 74 61 | 6e 64 61 72 64 20 6f 75 |inal.sta|ndard ou|
|00002840| 74 70 75 74 20 69 6e 73 | 74 65 61 64 2c 20 62 75 |tput ins|tead, bu|
|00002850| 74 20 74 68 69 73 20 69 | 73 20 6e 6f 74 20 73 61 |t this i|s not sa|
|00002860| 66 65 2c 20 61 6e 64 20 | 73 68 6f 75 6c 64 20 62 |fe, and |should b|
|00002870| 65 20 66 69 78 65 64 2e | 29 0d 5c 69 6e 64 65 78 |e fixed.|).\index|
|00002880| 69 69 7b 73 74 61 6e 64 | 61 72 64 7d 7b 6f 75 74 |ii{stand|ard}{out|
|00002890| 70 75 74 7d 0d 5c 62 69 | 6d 6f 64 69 6e 64 65 78 |put}.\bi|modindex|
|000028a0| 7b 73 79 73 7d 0d 5c 74 | 74 69 6e 64 65 78 7b 73 |{sys}.\t|tindex{s|
|000028b0| 74 64 6f 75 74 7d 0d 5c | 65 78 69 6e 64 65 78 7b |tdout}.\|exindex{|
|000028c0| 52 75 6e 74 69 6d 65 45 | 72 72 6f 72 7d 0d 0d 5c |RuntimeE|rror}..\|
|000028d0| 73 65 63 74 69 6f 6e 7b | 54 68 65 20 7b 5c 74 74 |section{|The {\tt|
|000028e0| 20 72 65 74 75 72 6e 7d | 20 73 74 61 74 65 6d 65 | return}| stateme|
|000028f0| 6e 74 7d 0d 5c 73 74 69 | 6e 64 65 78 7b 72 65 74 |nt}.\sti|ndex{ret|
|00002900| 75 72 6e 7d 0d 0d 5c 62 | 65 67 69 6e 7b 76 65 72 |urn}..\b|egin{ver|
|00002910| 62 61 74 69 6d 7d 0d 72 | 65 74 75 72 6e 5f 73 74 |batim}.r|eturn_st|
|00002920| 6d 74 3a 20 20 20 20 22 | 72 65 74 75 72 6e 22 20 |mt: "|return" |
|00002930| 5b 63 6f 6e 64 69 74 69 | 6f 6e 5f 6c 69 73 74 5d |[conditi|on_list]|
|00002940| 0d 5c 65 6e 64 7b 76 65 | 72 62 61 74 69 6d 7d 0d |.\end{ve|rbatim}.|
|00002950| 0d 5c 76 65 72 62 40 72 | 65 74 75 72 6e 40 20 6d |.\verb@r|eturn@ m|
|00002960| 61 79 20 6f 6e 6c 79 20 | 6f 63 63 75 72 20 73 79 |ay only |occur sy|
|00002970| 6e 74 61 63 74 69 63 61 | 6c 6c 79 20 6e 65 73 74 |ntactica|lly nest|
|00002980| 65 64 20 69 6e 20 61 20 | 66 75 6e 63 74 69 6f 6e |ed in a |function|
|00002990| 0d 64 65 66 69 6e 69 74 | 69 6f 6e 2c 20 6e 6f 74 |.definit|ion, not|
|000029a0| 20 77 69 74 68 69 6e 20 | 61 20 6e 65 73 74 65 64 | within |a nested|
|000029b0| 20 63 6c 61 73 73 20 64 | 65 66 69 6e 69 74 69 6f | class d|efinitio|
|000029c0| 6e 2e 0d 5c 69 6e 64 65 | 78 69 69 7b 66 75 6e 63 |n..\inde|xii{func|
|000029d0| 74 69 6f 6e 7d 7b 64 65 | 66 69 6e 69 74 69 6f 6e |tion}{de|finition|
|000029e0| 7d 0d 5c 69 6e 64 65 78 | 69 69 7b 63 6c 61 73 73 |}.\index|ii{class|
|000029f0| 7d 7b 64 65 66 69 6e 69 | 74 69 6f 6e 7d 0d 0d 49 |}{defini|tion}..I|
|00002a00| 66 20 61 20 63 6f 6e 64 | 69 74 69 6f 6e 20 6c 69 |f a cond|ition li|
|00002a10| 73 74 20 69 73 20 70 72 | 65 73 65 6e 74 2c 20 69 |st is pr|esent, i|
|00002a20| 74 20 69 73 20 65 76 61 | 6c 75 61 74 65 64 2c 20 |t is eva|luated, |
|00002a30| 65 6c 73 65 20 5c 76 65 | 72 62 40 4e 6f 6e 65 40 |else \ve|rb@None@|
|00002a40| 0d 69 73 20 73 75 62 73 | 74 69 74 75 74 65 64 2e |.is subs|tituted.|
|00002a50| 0d 0d 5c 76 65 72 62 40 | 72 65 74 75 72 6e 40 20 |..\verb@|return@ |
|00002a60| 6c 65 61 76 65 73 20 74 | 68 65 20 63 75 72 72 65 |leaves t|he curre|
|00002a70| 6e 74 20 66 75 6e 63 74 | 69 6f 6e 20 63 61 6c 6c |nt funct|ion call|
|00002a80| 20 77 69 74 68 20 74 68 | 65 20 63 6f 6e 64 69 74 | with th|e condit|
|00002a90| 69 6f 6e 0d 6c 69 73 74 | 20 28 6f 72 20 5c 76 65 |ion.list| (or \ve|
|00002aa0| 72 62 40 4e 6f 6e 65 40 | 29 20 61 73 20 72 65 74 |rb@None@|) as ret|
|00002ab0| 75 72 6e 20 76 61 6c 75 | 65 2e 0d 0d 57 68 65 6e |urn valu|e...When|
|00002ac0| 20 5c 76 65 72 62 40 72 | 65 74 75 72 6e 40 20 70 | \verb@r|eturn@ p|
|00002ad0| 61 73 73 65 73 20 63 6f | 6e 74 72 6f 6c 20 6f 75 |asses co|ntrol ou|
|00002ae0| 74 20 6f 66 20 61 20 5c | 76 65 72 62 40 74 72 79 |t of a \|verb@try|
|00002af0| 40 20 73 74 61 74 65 6d | 65 6e 74 0d 77 69 74 68 |@ statem|ent.with|
|00002b00| 20 61 20 5c 76 65 72 62 | 40 66 69 6e 61 6c 6c 79 | a \verb|@finally|
|00002b10| 40 20 63 6c 61 75 73 65 | 2c 20 74 68 61 74 20 66 |@ clause|, that f|
|00002b20| 69 6e 61 6c 6c 79 20 63 | 6c 61 75 73 65 20 69 73 |inally c|lause is|
|00002b30| 20 65 78 65 63 75 74 65 | 64 0d 62 65 66 6f 72 65 | execute|d.before|
|00002b40| 20 72 65 61 6c 6c 79 20 | 6c 65 61 76 69 6e 67 20 | really |leaving |
|00002b50| 74 68 65 20 66 75 6e 63 | 74 69 6f 6e 2e 0d 5c 6b |the func|tion..\k|
|00002b60| 77 69 6e 64 65 78 7b 66 | 69 6e 61 6c 6c 79 7d 0d |windex{f|inally}.|
|00002b70| 0d 5c 73 65 63 74 69 6f | 6e 7b 54 68 65 20 7b 5c |.\sectio|n{The {\|
|00002b80| 74 74 20 72 61 69 73 65 | 7d 20 73 74 61 74 65 6d |tt raise|} statem|
|00002b90| 65 6e 74 7d 0d 5c 73 74 | 69 6e 64 65 78 7b 72 61 |ent}.\st|index{ra|
|00002ba0| 69 73 65 7d 0d 0d 5c 62 | 65 67 69 6e 7b 76 65 72 |ise}..\b|egin{ver|
|00002bb0| 62 61 74 69 6d 7d 0d 72 | 61 69 73 65 5f 73 74 6d |batim}.r|aise_stm|
|00002bc0| 74 3a 20 20 20 20 20 22 | 72 61 69 73 65 22 20 63 |t: "|raise" c|
|00002bd0| 6f 6e 64 69 74 69 6f 6e | 20 5b 22 2c 22 20 63 6f |ondition| ["," co|
|00002be0| 6e 64 69 74 69 6f 6e 20 | 5b 22 2c 22 20 63 6f 6e |ndition |["," con|
|00002bf0| 64 69 74 69 6f 6e 5d 5d | 0d 5c 65 6e 64 7b 76 65 |dition]]|.\end{ve|
|00002c00| 72 62 61 74 69 6d 7d 0d | 0d 5c 76 65 72 62 40 72 |rbatim}.|.\verb@r|
|00002c10| 61 69 73 65 40 20 65 76 | 61 6c 75 61 74 65 73 20 |aise@ ev|aluates |
|00002c20| 69 74 73 20 66 69 72 73 | 74 20 63 6f 6e 64 69 74 |its firs|t condit|
|00002c30| 69 6f 6e 2c 20 77 68 69 | 63 68 20 6d 75 73 74 20 |ion, whi|ch must |
|00002c40| 79 69 65 6c 64 0d 61 20 | 73 74 72 69 6e 67 2c 20 |yield.a |string, |
|00002c50| 63 6c 61 73 73 2c 20 6f | 72 20 69 6e 73 74 61 6e |class, o|r instan|
|00002c60| 63 65 20 6f 62 6a 65 63 | 74 2e 20 20 49 66 20 74 |ce objec|t. If t|
|00002c70| 68 65 72 65 20 69 73 20 | 61 20 73 65 63 6f 6e 64 |here is |a second|
|00002c80| 20 63 6f 6e 64 69 74 69 | 6f 6e 2c 0d 74 68 69 73 | conditi|on,.this|
|00002c90| 20 69 73 20 65 76 61 6c | 75 61 74 65 64 2c 20 65 | is eval|uated, e|
|00002ca0| 6c 73 65 20 5c 76 65 72 | 62 40 4e 6f 6e 65 40 20 |lse \ver|b@None@ |
|00002cb0| 69 73 20 73 75 62 73 74 | 69 74 75 74 65 64 2e 20 |is subst|ituted. |
|00002cc0| 20 49 66 20 74 68 65 20 | 66 69 72 73 74 0d 63 6f | If the |first.co|
|00002cd0| 6e 64 69 74 69 6f 6e 20 | 69 73 20 61 20 63 6c 61 |ndition |is a cla|
|00002ce0| 73 73 20 6f 62 6a 65 63 | 74 2c 20 74 68 65 6e 20 |ss objec|t, then |
|00002cf0| 74 68 65 20 73 65 63 6f | 6e 64 20 63 6f 6e 64 69 |the seco|nd condi|
|00002d00| 74 69 6f 6e 20 6d 75 73 | 74 20 62 65 20 61 6e 0d |tion mus|t be an.|
|00002d10| 69 6e 73 74 61 6e 63 65 | 20 6f 66 20 74 68 61 74 |instance| of that|
|00002d20| 20 63 6c 61 73 73 20 6f | 72 20 6f 6e 65 20 6f 66 | class o|r one of|
|00002d30| 20 69 74 73 20 64 65 72 | 69 76 61 74 69 76 65 73 | its der|ivatives|
|00002d40| 2e 20 20 49 66 20 74 68 | 65 20 66 69 72 73 74 0d |. If th|e first.|
|00002d50| 63 6f 6e 64 69 74 69 6f | 6e 20 69 73 20 61 6e 20 |conditio|n is an |
|00002d60| 69 6e 73 74 61 6e 63 65 | 20 6f 62 6a 65 63 74 2c |instance| object,|
|00002d70| 20 74 68 65 20 73 65 63 | 6f 6e 64 20 63 6f 6e 64 | the sec|ond cond|
|00002d80| 69 74 69 6f 6e 20 6d 75 | 73 74 20 62 65 0d 5c 76 |ition mu|st be.\v|
|00002d90| 65 72 62 40 4e 6f 6e 65 | 40 2e 0d 5c 69 6e 64 65 |erb@None|@..\inde|
|00002da0| 78 7b 65 78 63 65 70 74 | 69 6f 6e 7d 0d 5c 69 6e |x{except|ion}.\in|
|00002db0| 64 65 78 69 69 7b 72 61 | 69 73 69 6e 67 7d 7b 65 |dexii{ra|ising}{e|
|00002dc0| 78 63 65 70 74 69 6f 6e | 7d 0d 0d 49 66 20 74 68 |xception|}..If th|
|00002dd0| 65 20 66 69 72 73 74 20 | 6f 62 6a 65 63 74 20 69 |e first |object i|
|00002de0| 73 20 61 20 63 6c 61 73 | 73 20 6f 72 20 73 74 72 |s a clas|s or str|
|00002df0| 69 6e 67 2c 20 69 74 20 | 74 68 65 6e 20 72 61 69 |ing, it |then rai|
|00002e00| 73 65 73 20 74 68 65 20 | 65 78 63 65 70 74 69 6f |ses the |exceptio|
|00002e10| 6e 0d 69 64 65 6e 74 69 | 66 69 65 64 20 62 79 20 |n.identi|fied by |
|00002e20| 74 68 65 20 66 69 72 73 | 74 20 6f 62 6a 65 63 74 |the firs|t object|
|00002e30| 2c 20 77 69 74 68 20 74 | 68 65 20 73 65 63 6f 6e |, with t|he secon|
|00002e40| 64 20 6f 6e 65 20 28 6f | 72 20 5c 76 65 72 62 40 |d one (o|r \verb@|
|00002e50| 4e 6f 6e 65 40 29 0d 61 | 73 20 69 74 73 20 70 61 |None@).a|s its pa|
|00002e60| 72 61 6d 65 74 65 72 2e | 20 20 49 66 20 74 68 65 |rameter.| If the|
|00002e70| 20 66 69 72 73 74 20 6f | 62 6a 65 63 74 20 69 73 | first o|bject is|
|00002e80| 20 61 6e 20 69 6e 73 74 | 61 6e 63 65 2c 20 69 74 | an inst|ance, it|
|00002e90| 20 72 61 69 73 65 73 20 | 74 68 65 0d 65 78 63 65 | raises |the.exce|
|00002ea0| 70 74 69 6f 6e 20 69 64 | 65 6e 74 69 66 69 65 64 |ption id|entified|
|00002eb0| 20 62 79 20 74 68 65 20 | 63 6c 61 73 73 20 6f 66 | by the |class of|
|00002ec0| 20 74 68 65 20 6f 62 6a | 65 63 74 2c 20 77 69 74 | the obj|ect, wit|
|00002ed0| 68 20 74 68 65 20 69 6e | 73 74 61 6e 63 65 20 61 |h the in|stance a|
|00002ee0| 73 0d 69 74 73 20 70 61 | 72 61 6d 65 74 65 72 20 |s.its pa|rameter |
|00002ef0| 28 61 6e 64 20 74 68 65 | 72 65 20 73 68 6f 75 6c |(and the|re shoul|
|00002f00| 64 20 62 65 20 6e 6f 20 | 73 65 63 6f 6e 64 20 6f |d be no |second o|
|00002f10| 62 6a 65 63 74 2c 20 6f | 72 20 74 68 65 20 73 65 |bject, o|r the se|
|00002f20| 63 6f 6e 64 0d 6f 62 6a | 65 63 74 20 73 68 6f 75 |cond.obj|ect shou|
|00002f30| 6c 64 20 62 65 20 5c 76 | 65 72 62 40 4e 6f 6e 65 |ld be \v|erb@None|
|00002f40| 40 29 2e 0d 0d 49 66 20 | 61 20 74 68 69 72 64 20 |@)...If |a third |
|00002f50| 6f 62 6a 65 63 74 20 69 | 73 20 70 72 65 73 65 6e |object i|s presen|
|00002f60| 74 2c 20 61 6e 64 20 69 | 74 20 69 74 20 6e 6f 74 |t, and i|t it not|
|00002f70| 20 5c 76 65 72 62 40 4e | 6f 6e 65 40 2c 20 69 74 | \verb@N|one@, it|
|00002f80| 20 73 68 6f 75 6c 64 20 | 62 65 0d 61 20 74 72 61 | should |be.a tra|
|00002f90| 63 65 62 61 63 6b 20 6f | 62 6a 65 63 74 20 28 73 |ceback o|bject (s|
|00002fa0| 65 65 20 73 65 63 74 69 | 6f 6e 20 5c 72 65 66 7b |ee secti|on \ref{|
|00002fb0| 74 72 61 63 65 62 61 63 | 6b 7d 29 2c 20 61 6e 64 |tracebac|k}), and|
|00002fc0| 20 69 74 20 69 73 0d 73 | 75 62 73 74 69 74 75 74 | it is.s|ubstitut|
|00002fd0| 65 64 20 69 6e 73 74 65 | 61 64 20 6f 66 20 74 68 |ed inste|ad of th|
|00002fe0| 65 20 63 75 72 72 65 6e | 74 20 6c 6f 63 61 74 69 |e curren|t locati|
|00002ff0| 6f 6e 20 61 73 20 74 68 | 65 20 70 6c 61 63 65 20 |on as th|e place |
|00003000| 77 68 65 72 65 20 74 68 | 65 0d 65 78 63 65 70 74 |where th|e.except|
|00003010| 69 6f 6e 20 6f 63 63 75 | 72 72 65 64 2e 20 20 54 |ion occu|rred. T|
|00003020| 68 69 73 20 69 73 20 75 | 73 65 66 75 6c 20 74 6f |his is u|seful to|
|00003030| 20 72 65 2d 72 61 69 73 | 65 20 61 6e 20 65 78 63 | re-rais|e an exc|
|00003040| 65 70 74 69 6f 6e 0d 74 | 72 61 6e 73 70 61 72 65 |eption.t|ranspare|
|00003050| 6e 74 6c 79 20 69 6e 20 | 61 6e 20 65 78 63 65 70 |ntly in |an excep|
|00003060| 74 20 63 6c 61 75 73 65 | 2e 0d 5c 6f 62 69 6e 64 |t clause|..\obind|
|00003070| 65 78 7b 74 72 61 63 65 | 62 61 63 6b 7d 0d 0d 5c |ex{trace|back}..\|
|00003080| 73 65 63 74 69 6f 6e 7b | 54 68 65 20 7b 5c 74 74 |section{|The {\tt|
|00003090| 20 62 72 65 61 6b 7d 20 | 73 74 61 74 65 6d 65 6e | break} |statemen|
|000030a0| 74 7d 0d 5c 73 74 69 6e | 64 65 78 7b 62 72 65 61 |t}.\stin|dex{brea|
|000030b0| 6b 7d 0d 0d 5c 62 65 67 | 69 6e 7b 76 65 72 62 61 |k}..\beg|in{verba|
|000030c0| 74 69 6d 7d 0d 62 72 65 | 61 6b 5f 73 74 6d 74 3a |tim}.bre|ak_stmt:|
|000030d0| 20 20 20 20 20 22 62 72 | 65 61 6b 22 0d 5c 65 6e | "br|eak".\en|
|000030e0| 64 7b 76 65 72 62 61 74 | 69 6d 7d 0d 0d 5c 76 65 |d{verbat|im}..\ve|
|000030f0| 72 62 40 62 72 65 61 6b | 40 20 6d 61 79 20 6f 6e |rb@break|@ may on|
|00003100| 6c 79 20 6f 63 63 75 72 | 20 73 79 6e 74 61 63 74 |ly occur| syntact|
|00003110| 69 63 61 6c 6c 79 20 6e | 65 73 74 65 64 20 69 6e |ically n|ested in|
|00003120| 20 61 20 5c 76 65 72 62 | 40 66 6f 72 40 0d 6f 72 | a \verb|@for@.or|
|00003130| 20 5c 76 65 72 62 40 77 | 68 69 6c 65 40 20 6c 6f | \verb@w|hile@ lo|
|00003140| 6f 70 2c 20 62 75 74 20 | 6e 6f 74 20 6e 65 73 74 |op, but |not nest|
|00003150| 65 64 20 69 6e 20 61 20 | 66 75 6e 63 74 69 6f 6e |ed in a |function|
|00003160| 20 6f 72 20 63 6c 61 73 | 73 20 64 65 66 69 6e 69 | or clas|s defini|
|00003170| 74 69 6f 6e 0d 77 69 74 | 68 69 6e 20 74 68 61 74 |tion.wit|hin that|
|00003180| 20 6c 6f 6f 70 2e 0d 5c | 73 74 69 6e 64 65 78 7b | loop..\|stindex{|
|00003190| 66 6f 72 7d 0d 5c 73 74 | 69 6e 64 65 78 7b 77 68 |for}.\st|index{wh|
|000031a0| 69 6c 65 7d 0d 5c 69 6e | 64 65 78 69 69 7b 6c 6f |ile}.\in|dexii{lo|
|000031b0| 6f 70 7d 7b 73 74 61 74 | 65 6d 65 6e 74 7d 0d 0d |op}{stat|ement}..|
|000031c0| 49 74 20 74 65 72 6d 69 | 6e 61 74 65 73 20 74 68 |It termi|nates th|
|000031d0| 65 20 6e 65 61 72 65 73 | 74 20 65 6e 63 6c 6f 73 |e neares|t enclos|
|000031e0| 69 6e 67 20 6c 6f 6f 70 | 2c 20 73 6b 69 70 70 69 |ing loop|, skippi|
|000031f0| 6e 67 20 74 68 65 20 6f | 70 74 69 6f 6e 61 6c 0d |ng the o|ptional.|
|00003200| 5c 76 65 72 62 40 65 6c | 73 65 40 20 63 6c 61 75 |\verb@el|se@ clau|
|00003210| 73 65 20 69 66 20 74 68 | 65 20 6c 6f 6f 70 20 68 |se if th|e loop h|
|00003220| 61 73 20 6f 6e 65 2e 0d | 5c 6b 77 69 6e 64 65 78 |as one..|\kwindex|
|00003230| 7b 65 6c 73 65 7d 0d 0d | 49 66 20 61 20 5c 76 65 |{else}..|If a \ve|
|00003240| 72 62 40 66 6f 72 40 20 | 6c 6f 6f 70 20 69 73 20 |rb@for@ |loop is |
|00003250| 74 65 72 6d 69 6e 61 74 | 65 64 20 62 79 20 5c 76 |terminat|ed by \v|
|00003260| 65 72 62 40 62 72 65 61 | 6b 40 2c 20 74 68 65 20 |erb@brea|k@, the |
|00003270| 6c 6f 6f 70 20 63 6f 6e | 74 72 6f 6c 0d 74 61 72 |loop con|trol.tar|
|00003280| 67 65 74 20 6b 65 65 70 | 73 20 69 74 73 20 63 75 |get keep|s its cu|
|00003290| 72 72 65 6e 74 20 76 61 | 6c 75 65 2e 0d 5c 69 6e |rrent va|lue..\in|
|000032a0| 64 65 78 69 69 7b 6c 6f | 6f 70 20 63 6f 6e 74 72 |dexii{lo|op contr|
|000032b0| 6f 6c 7d 7b 74 61 72 67 | 65 74 7d 0d 0d 57 68 65 |ol}{targ|et}..Whe|
|000032c0| 6e 20 5c 76 65 72 62 40 | 62 72 65 61 6b 40 20 70 |n \verb@|break@ p|
|000032d0| 61 73 73 65 73 20 63 6f | 6e 74 72 6f 6c 20 6f 75 |asses co|ntrol ou|
|000032e0| 74 20 6f 66 20 61 20 5c | 76 65 72 62 40 74 72 79 |t of a \|verb@try|
|000032f0| 40 20 73 74 61 74 65 6d | 65 6e 74 0d 77 69 74 68 |@ statem|ent.with|
|00003300| 20 61 20 5c 76 65 72 62 | 40 66 69 6e 61 6c 6c 79 | a \verb|@finally|
|00003310| 40 20 63 6c 61 75 73 65 | 2c 20 74 68 61 74 20 66 |@ clause|, that f|
|00003320| 69 6e 61 6c 6c 79 20 63 | 6c 61 75 73 65 20 69 73 |inally c|lause is|
|00003330| 20 65 78 65 63 75 74 65 | 64 0d 62 65 66 6f 72 65 | execute|d.before|
|00003340| 20 72 65 61 6c 6c 79 20 | 6c 65 61 76 69 6e 67 20 | really |leaving |
|00003350| 74 68 65 20 6c 6f 6f 70 | 2e 0d 5c 6b 77 69 6e 64 |the loop|..\kwind|
|00003360| 65 78 7b 66 69 6e 61 6c | 6c 79 7d 0d 0d 5c 73 65 |ex{final|ly}..\se|
|00003370| 63 74 69 6f 6e 7b 54 68 | 65 20 7b 5c 74 74 20 63 |ction{Th|e {\tt c|
|00003380| 6f 6e 74 69 6e 75 65 7d | 20 73 74 61 74 65 6d 65 |ontinue}| stateme|
|00003390| 6e 74 7d 0d 5c 73 74 69 | 6e 64 65 78 7b 63 6f 6e |nt}.\sti|ndex{con|
|000033a0| 74 69 6e 75 65 7d 0d 0d | 5c 62 65 67 69 6e 7b 76 |tinue}..|\begin{v|
|000033b0| 65 72 62 61 74 69 6d 7d | 0d 63 6f 6e 74 69 6e 75 |erbatim}|.continu|
|000033c0| 65 5f 73 74 6d 74 3a 20 | 20 22 63 6f 6e 74 69 6e |e_stmt: | "contin|
|000033d0| 75 65 22 0d 5c 65 6e 64 | 7b 76 65 72 62 61 74 69 |ue".\end|{verbati|
|000033e0| 6d 7d 0d 0d 5c 76 65 72 | 62 40 63 6f 6e 74 69 6e |m}..\ver|b@contin|
|000033f0| 75 65 40 20 6d 61 79 20 | 6f 6e 6c 79 20 6f 63 63 |ue@ may |only occ|
|00003400| 75 72 20 73 79 6e 74 61 | 63 74 69 63 61 6c 6c 79 |ur synta|ctically|
|00003410| 20 6e 65 73 74 65 64 20 | 69 6e 20 61 20 5c 76 65 | nested |in a \ve|
|00003420| 72 62 40 66 6f 72 40 20 | 6f 72 0d 5c 76 65 72 62 |rb@for@ |or.\verb|
|00003430| 40 77 68 69 6c 65 40 20 | 6c 6f 6f 70 2c 20 62 75 |@while@ |loop, bu|
|00003440| 74 20 6e 6f 74 20 6e 65 | 73 74 65 64 20 69 6e 20 |t not ne|sted in |
|00003450| 61 20 66 75 6e 63 74 69 | 6f 6e 20 6f 72 20 63 6c |a functi|on or cl|
|00003460| 61 73 73 20 64 65 66 69 | 6e 69 74 69 6f 6e 20 6f |ass defi|nition o|
|00003470| 72 0d 5c 76 65 72 62 40 | 74 72 79 40 20 73 74 61 |r.\verb@|try@ sta|
|00003480| 74 65 6d 65 6e 74 20 77 | 69 74 68 69 6e 20 74 68 |tement w|ithin th|
|00003490| 61 74 20 6c 6f 6f 70 2e | 5c 66 6f 6f 74 6e 6f 74 |at loop.|\footnot|
|000034a0| 65 7b 45 78 63 65 70 74 | 20 74 68 61 74 20 69 74 |e{Except| that it|
|000034b0| 20 6d 61 79 0d 63 75 72 | 72 65 6e 74 6c 79 20 6f | may.cur|rently o|
|000034c0| 63 63 75 72 20 77 69 74 | 68 69 6e 20 61 6e 20 7b |ccur wit|hin an {|
|000034d0| 5c 74 74 20 65 78 63 65 | 70 74 7d 20 63 6c 61 75 |\tt exce|pt} clau|
|000034e0| 73 65 2e 7d 0d 5c 73 74 | 69 6e 64 65 78 7b 66 6f |se.}.\st|index{fo|
|000034f0| 72 7d 0d 5c 73 74 69 6e | 64 65 78 7b 77 68 69 6c |r}.\stin|dex{whil|
|00003500| 65 7d 0d 5c 69 6e 64 65 | 78 69 69 7b 6c 6f 6f 70 |e}.\inde|xii{loop|
|00003510| 7d 7b 73 74 61 74 65 6d | 65 6e 74 7d 0d 5c 6b 77 |}{statem|ent}.\kw|
|00003520| 69 6e 64 65 78 7b 66 69 | 6e 61 6c 6c 79 7d 0d 0d |index{fi|nally}..|
|00003530| 49 74 20 63 6f 6e 74 69 | 6e 75 65 73 20 77 69 74 |It conti|nues wit|
|00003540| 68 20 74 68 65 20 6e 65 | 78 74 20 63 79 63 6c 65 |h the ne|xt cycle|
|00003550| 20 6f 66 20 74 68 65 20 | 6e 65 61 72 65 73 74 20 | of the |nearest |
|00003560| 65 6e 63 6c 6f 73 69 6e | 67 20 6c 6f 6f 70 2e 0d |enclosin|g loop..|
|00003570| 0d 5c 73 65 63 74 69 6f | 6e 7b 54 68 65 20 7b 5c |.\sectio|n{The {\|
|00003580| 74 74 20 69 6d 70 6f 72 | 74 7d 20 73 74 61 74 65 |tt impor|t} state|
|00003590| 6d 65 6e 74 7d 20 5c 6c | 61 62 65 6c 7b 69 6d 70 |ment} \l|abel{imp|
|000035a0| 6f 72 74 7d 0d 5c 73 74 | 69 6e 64 65 78 7b 69 6d |ort}.\st|index{im|
|000035b0| 70 6f 72 74 7d 0d 0d 5c | 62 65 67 69 6e 7b 76 65 |port}..\|begin{ve|
|000035c0| 72 62 61 74 69 6d 7d 0d | 69 6d 70 6f 72 74 5f 73 |rbatim}.|import_s|
|000035d0| 74 6d 74 3a 20 20 20 20 | 22 69 6d 70 6f 72 74 22 |tmt: |"import"|
|000035e0| 20 69 64 65 6e 74 69 66 | 69 65 72 20 28 22 2c 22 | identif|ier (","|
|000035f0| 20 69 64 65 6e 74 69 66 | 69 65 72 29 2a 0d 20 20 | identif|ier)*. |
|00003600| 20 20 20 20 20 20 20 20 | 20 20 20 20 7c 20 22 66 | | | "f|
|00003610| 72 6f 6d 22 20 69 64 65 | 6e 74 69 66 69 65 72 20 |rom" ide|ntifier |
|00003620| 22 69 6d 70 6f 72 74 22 | 20 69 64 65 6e 74 69 66 |"import"| identif|
|00003630| 69 65 72 20 28 22 2c 22 | 20 69 64 65 6e 74 69 66 |ier (","| identif|
|00003640| 69 65 72 29 2a 0d 20 20 | 20 20 20 20 20 20 20 20 |ier)*. | |
|00003650| 20 20 20 20 7c 20 22 66 | 72 6f 6d 22 20 69 64 65 | | "f|rom" ide|
|00003660| 6e 74 69 66 69 65 72 20 | 22 69 6d 70 6f 72 74 22 |ntifier |"import"|
|00003670| 20 22 2a 22 0d 5c 65 6e | 64 7b 76 65 72 62 61 74 | "*".\en|d{verbat|
|00003680| 69 6d 7d 0d 0d 49 6d 70 | 6f 72 74 20 73 74 61 74 |im}..Imp|ort stat|
|00003690| 65 6d 65 6e 74 73 20 61 | 72 65 20 65 78 65 63 75 |ements a|re execu|
|000036a0| 74 65 64 20 69 6e 20 74 | 77 6f 20 73 74 65 70 73 |ted in t|wo steps|
|000036b0| 3a 20 28 31 29 20 66 69 | 6e 64 20 61 20 6d 6f 64 |: (1) fi|nd a mod|
|000036c0| 75 6c 65 2c 20 61 6e 64 | 0d 69 6e 69 74 69 61 6c |ule, and|.initial|
|000036d0| 69 7a 65 20 69 74 20 69 | 66 20 6e 65 63 65 73 73 |ize it i|f necess|
|000036e0| 61 72 79 3b 20 28 32 29 | 20 64 65 66 69 6e 65 20 |ary; (2)| define |
|000036f0| 61 20 6e 61 6d 65 20 6f | 72 20 6e 61 6d 65 73 20 |a name o|r names |
|00003700| 69 6e 20 74 68 65 20 6c | 6f 63 61 6c 0d 6e 61 6d |in the l|ocal.nam|
|00003710| 65 20 73 70 61 63 65 20 | 28 6f 66 20 74 68 65 20 |e space |(of the |
|00003720| 73 63 6f 70 65 20 77 68 | 65 72 65 20 74 68 65 20 |scope wh|ere the |
|00003730| 5c 76 65 72 62 40 69 6d | 70 6f 72 74 40 20 73 74 |\verb@im|port@ st|
|00003740| 61 74 65 6d 65 6e 74 20 | 6f 63 63 75 72 73 29 2e |atement |occurs).|
|00003750| 0d 54 68 65 20 66 69 72 | 73 74 20 66 6f 72 6d 20 |.The fir|st form |
|00003760| 28 77 69 74 68 6f 75 74 | 20 5c 76 65 72 62 40 66 |(without| \verb@f|
|00003770| 72 6f 6d 40 29 20 72 65 | 70 65 61 74 73 20 74 68 |rom@) re|peats th|
|00003780| 65 73 65 20 73 74 65 70 | 73 20 66 6f 72 20 65 61 |ese step|s for ea|
|00003790| 63 68 0d 69 64 65 6e 74 | 69 66 69 65 72 20 69 6e |ch.ident|ifier in|
|000037a0| 20 74 68 65 20 6c 69 73 | 74 2c 20 74 68 65 20 5c | the lis|t, the \|
|000037b0| 76 65 72 62 40 66 72 6f | 6d 40 20 66 6f 72 6d 20 |verb@fro|m@ form |
|000037c0| 70 65 72 66 6f 72 6d 73 | 20 74 68 65 6d 20 6f 6e |performs| them on|
|000037d0| 63 65 2c 20 77 69 74 68 | 0d 74 68 65 20 66 69 72 |ce, with|.the fir|
|000037e0| 73 74 20 69 64 65 6e 74 | 69 66 69 65 72 20 73 70 |st ident|ifier sp|
|000037f0| 65 63 69 66 79 69 6e 67 | 20 74 68 65 20 6d 6f 64 |ecifying| the mod|
|00003800| 75 6c 65 20 6e 61 6d 65 | 2e 0d 5c 69 6e 64 65 78 |ule name|..\index|
|00003810| 69 69 7b 69 6d 70 6f 72 | 74 69 6e 67 7d 7b 6d 6f |ii{impor|ting}{mo|
|00003820| 64 75 6c 65 7d 0d 5c 69 | 6e 64 65 78 69 69 7b 6e |dule}.\i|ndexii{n|
|00003830| 61 6d 65 7d 7b 62 69 6e | 64 69 6e 67 7d 0d 5c 6b |ame}{bin|ding}.\k|
|00003840| 77 69 6e 64 65 78 7b 66 | 72 6f 6d 7d 0d 0d 54 68 |windex{f|rom}..Th|
|00003850| 65 20 73 79 73 74 65 6d | 20 6d 61 69 6e 74 61 69 |e system| maintai|
|00003860| 6e 73 20 61 20 74 61 62 | 6c 65 20 6f 66 20 6d 6f |ns a tab|le of mo|
|00003870| 64 75 6c 65 73 20 74 68 | 61 74 20 68 61 76 65 20 |dules th|at have |
|00003880| 62 65 65 6e 20 69 6e 69 | 74 69 61 6c 69 7a 65 64 |been ini|tialized|
|00003890| 2c 0d 69 6e 64 65 78 65 | 64 20 62 79 20 6d 6f 64 |,.indexe|d by mod|
|000038a0| 75 6c 65 20 6e 61 6d 65 | 2e 20 20 28 54 68 65 20 |ule name|. (The |
|000038b0| 63 75 72 72 65 6e 74 20 | 69 6d 70 6c 65 6d 65 6e |current |implemen|
|000038c0| 74 61 74 69 6f 6e 20 6d | 61 6b 65 73 20 74 68 69 |tation m|akes thi|
|000038d0| 73 20 74 61 62 6c 65 0d | 61 63 63 65 73 73 69 62 |s table.|accessib|
|000038e0| 6c 65 20 61 73 20 5c 76 | 65 72 62 40 73 79 73 2e |le as \v|erb@sys.|
|000038f0| 6d 6f 64 75 6c 65 73 40 | 2e 29 20 20 57 68 65 6e |modules@|.) When|
|00003900| 20 61 20 6d 6f 64 75 6c | 65 20 6e 61 6d 65 20 69 | a modul|e name i|
|00003910| 73 20 66 6f 75 6e 64 20 | 69 6e 0d 74 68 69 73 20 |s found |in.this |
|00003920| 74 61 62 6c 65 2c 20 73 | 74 65 70 20 28 31 29 20 |table, s|tep (1) |
|00003930| 69 73 20 66 69 6e 69 73 | 68 65 64 2e 20 20 49 66 |is finis|hed. If|
|00003940| 20 6e 6f 74 2c 20 61 20 | 73 65 61 72 63 68 20 66 | not, a |search f|
|00003950| 6f 72 20 61 20 6d 6f 64 | 75 6c 65 0d 64 65 66 69 |or a mod|ule.defi|
|00003960| 6e 69 74 69 6f 6e 20 69 | 73 20 73 74 61 72 74 65 |nition i|s starte|
|00003970| 64 2e 20 20 54 68 69 73 | 20 66 69 72 73 74 20 6c |d. This| first l|
|00003980| 6f 6f 6b 73 20 66 6f 72 | 20 61 20 62 75 69 6c 74 |ooks for| a built|
|00003990| 2d 69 6e 20 6d 6f 64 75 | 6c 65 0d 64 65 66 69 6e |-in modu|le.defin|
|000039a0| 69 74 69 6f 6e 2c 20 61 | 6e 64 20 69 66 20 6e 6f |ition, a|nd if no|
|000039b0| 20 62 75 69 6c 74 2d 69 | 6e 20 6d 6f 64 75 6c 65 | built-i|n module|
|000039c0| 20 69 66 20 74 68 65 20 | 67 69 76 65 6e 20 6e 61 | if the |given na|
|000039d0| 6d 65 20 69 73 20 66 6f | 75 6e 64 2c 20 69 74 0d |me is fo|und, it.|
|000039e0| 73 65 61 72 63 68 65 73 | 20 61 20 75 73 65 72 2d |searches| a user-|
|000039f0| 73 70 65 63 69 66 69 65 | 64 20 6c 69 73 74 20 6f |specifie|d list o|
|00003a00| 66 20 64 69 72 65 63 74 | 6f 72 69 65 73 20 66 6f |f direct|ories fo|
|00003a10| 72 20 61 20 66 69 6c 65 | 20 77 68 6f 73 65 20 6e |r a file| whose n|
|00003a20| 61 6d 65 20 69 73 0d 74 | 68 65 20 6d 6f 64 75 6c |ame is.t|he modul|
|00003a30| 65 20 6e 61 6d 65 20 77 | 69 74 68 20 65 78 74 65 |e name w|ith exte|
|00003a40| 6e 73 69 6f 6e 20 5c 76 | 65 72 62 40 22 2e 70 79 |nsion \v|erb@".py|
|00003a50| 22 40 2e 20 20 28 54 68 | 65 20 63 75 72 72 65 6e |"@. (Th|e curren|
|00003a60| 74 0d 69 6d 70 6c 65 6d | 65 6e 74 61 74 69 6f 6e |t.implem|entation|
|00003a70| 20 75 73 65 73 20 74 68 | 65 20 6c 69 73 74 20 6f | uses th|e list o|
|00003a80| 66 20 73 74 72 69 6e 67 | 73 20 5c 76 65 72 62 40 |f string|s \verb@|
|00003a90| 73 79 73 2e 70 61 74 68 | 40 20 61 73 20 74 68 65 |sys.path|@ as the|
|00003aa0| 20 73 65 61 72 63 68 0d | 70 61 74 68 3b 20 69 74 | search.|path; it|
|00003ab0| 20 69 73 20 69 6e 69 74 | 69 61 6c 69 7a 65 64 20 | is init|ialized |
|00003ac0| 66 72 6f 6d 20 74 68 65 | 20 73 68 65 6c 6c 20 65 |from the| shell e|
|00003ad0| 6e 76 69 72 6f 6e 6d 65 | 6e 74 20 76 61 72 69 61 |nvironme|nt varia|
|00003ae0| 62 6c 65 0d 5c 76 65 72 | 62 40 24 50 59 54 48 4f |ble.\ver|b@$PYTHO|
|00003af0| 4e 50 41 54 48 40 2c 20 | 77 69 74 68 20 61 6e 20 |NPATH@, |with an |
|00003b00| 69 6e 73 74 61 6c 6c 61 | 74 69 6f 6e 2d 64 65 70 |installa|tion-dep|
|00003b10| 65 6e 64 65 6e 74 20 64 | 65 66 61 75 6c 74 2e 29 |endent d|efault.)|
|00003b20| 0d 5c 74 74 69 6e 64 65 | 78 7b 6d 6f 64 75 6c 65 |.\ttinde|x{module|
|00003b30| 73 7d 0d 5c 74 74 69 6e | 64 65 78 7b 73 79 73 2e |s}.\ttin|dex{sys.|
|00003b40| 6d 6f 64 75 6c 65 73 7d | 0d 5c 69 6e 64 65 78 69 |modules}|.\indexi|
|00003b50| 69 7b 6d 6f 64 75 6c 65 | 7d 7b 6e 61 6d 65 7d 0d |i{module|}{name}.|
|00003b60| 5c 69 6e 64 65 78 69 69 | 7b 62 75 69 6c 74 2d 69 |\indexii|{built-i|
|00003b70| 6e 7d 7b 6d 6f 64 75 6c | 65 7d 0d 5c 69 6e 64 65 |n}{modul|e}.\inde|
|00003b80| 78 69 69 7b 75 73 65 72 | 2d 64 65 66 69 6e 65 64 |xii{user|-defined|
|00003b90| 7d 7b 6d 6f 64 75 6c 65 | 7d 0d 5c 62 69 6d 6f 64 |}{module|}.\bimod|
|00003ba0| 69 6e 64 65 78 7b 73 79 | 73 7d 0d 5c 74 74 69 6e |index{sy|s}.\ttin|
|00003bb0| 64 65 78 7b 70 61 74 68 | 7d 0d 5c 74 74 69 6e 64 |dex{path|}.\ttind|
|00003bc0| 65 78 7b 73 79 73 2e 70 | 61 74 68 7d 0d 5c 69 6e |ex{sys.p|ath}.\in|
|00003bd0| 64 65 78 69 69 7b 66 69 | 6c 65 6e 61 6d 65 7d 7b |dexii{fi|lename}{|
|00003be0| 65 78 74 65 6e 73 69 6f | 6e 7d 0d 0d 49 66 20 61 |extensio|n}..If a|
|00003bf0| 20 62 75 69 6c 74 2d 69 | 6e 20 6d 6f 64 75 6c 65 | built-i|n module|
|00003c00| 20 69 73 20 66 6f 75 6e | 64 2c 20 69 74 73 20 62 | is foun|d, its b|
|00003c10| 75 69 6c 74 2d 69 6e 20 | 69 6e 69 74 69 61 6c 69 |uilt-in |initiali|
|00003c20| 7a 61 74 69 6f 6e 20 63 | 6f 64 65 20 69 73 0d 65 |zation c|ode is.e|
|00003c30| 78 65 63 75 74 65 64 20 | 61 6e 64 20 73 74 65 70 |xecuted |and step|
|00003c40| 20 28 31 29 20 69 73 20 | 66 69 6e 69 73 68 65 64 | (1) is |finished|
|00003c50| 2e 20 20 49 66 20 6e 6f | 20 6d 61 74 63 68 69 6e |. If no| matchin|
|00003c60| 67 20 66 69 6c 65 20 69 | 73 20 66 6f 75 6e 64 2c |g file i|s found,|
|00003c70| 0d 5c 76 65 72 62 40 49 | 6d 70 6f 72 74 45 72 72 |.\verb@I|mportErr|
|00003c80| 6f 72 40 20 69 73 20 72 | 61 69 73 65 64 2e 20 20 |or@ is r|aised. |
|00003c90| 49 66 20 61 20 66 69 6c | 65 20 69 73 20 66 6f 75 |If a fil|e is fou|
|00003ca0| 6e 64 2c 20 69 74 20 69 | 73 20 70 61 72 73 65 64 |nd, it i|s parsed|
|00003cb0| 2c 0d 79 69 65 6c 64 69 | 6e 67 20 61 6e 20 65 78 |,.yieldi|ng an ex|
|00003cc0| 65 63 75 74 61 62 6c 65 | 20 63 6f 64 65 20 62 6c |ecutable| code bl|
|00003cd0| 6f 63 6b 2e 20 20 49 66 | 20 61 20 73 79 6e 74 61 |ock. If| a synta|
|00003ce0| 78 20 65 72 72 6f 72 20 | 6f 63 63 75 72 73 2c 0d |x error |occurs,.|
|00003cf0| 5c 76 65 72 62 40 53 79 | 6e 74 61 78 45 72 72 6f |\verb@Sy|ntaxErro|
|00003d00| 72 40 20 69 73 20 72 61 | 69 73 65 64 2e 20 20 4f |r@ is ra|ised. O|
|00003d10| 74 68 65 72 77 69 73 65 | 2c 20 61 6e 20 65 6d 70 |therwise|, an emp|
|00003d20| 74 79 20 6d 6f 64 75 6c | 65 20 6f 66 20 74 68 65 |ty modul|e of the|
|00003d30| 20 67 69 76 65 6e 0d 6e | 61 6d 65 20 69 73 20 63 | given.n|ame is c|
|00003d40| 72 65 61 74 65 64 20 61 | 6e 64 20 69 6e 73 65 72 |reated a|nd inser|
|00003d50| 74 65 64 20 69 6e 20 74 | 68 65 20 6d 6f 64 75 6c |ted in t|he modul|
|00003d60| 65 20 74 61 62 6c 65 2c | 20 61 6e 64 20 74 68 65 |e table,| and the|
|00003d70| 6e 20 74 68 65 20 63 6f | 64 65 0d 62 6c 6f 63 6b |n the co|de.block|
|00003d80| 20 69 73 20 65 78 65 63 | 75 74 65 64 20 69 6e 20 | is exec|uted in |
|00003d90| 74 68 65 20 63 6f 6e 74 | 65 78 74 20 6f 66 20 74 |the cont|ext of t|
|00003da0| 68 69 73 20 6d 6f 64 75 | 6c 65 2e 20 20 45 78 63 |his modu|le. Exc|
|00003db0| 65 70 74 69 6f 6e 73 20 | 64 75 72 69 6e 67 0d 74 |eptions |during.t|
|00003dc0| 68 69 73 20 65 78 65 63 | 75 74 69 6f 6e 20 74 65 |his exec|ution te|
|00003dd0| 72 6d 69 6e 61 74 65 20 | 73 74 65 70 20 28 31 29 |rminate |step (1)|
|00003de0| 2e 0d 5c 69 6e 64 65 78 | 69 69 7b 6d 6f 64 75 6c |..\index|ii{modul|
|00003df0| 65 7d 7b 69 6e 69 74 69 | 61 6c 69 7a 61 74 69 6f |e}{initi|alizatio|
|00003e00| 6e 7d 0d 5c 65 78 69 6e | 64 65 78 7b 53 79 6e 74 |n}.\exin|dex{Synt|
|00003e10| 61 78 45 72 72 6f 72 7d | 0d 5c 65 78 69 6e 64 65 |axError}|.\exinde|
|00003e20| 78 7b 49 6d 70 6f 72 74 | 45 72 72 6f 72 7d 0d 5c |x{Import|Error}.\|
|00003e30| 69 6e 64 65 78 7b 63 6f | 64 65 20 62 6c 6f 63 6b |index{co|de block|
|00003e40| 7d 0d 0d 57 68 65 6e 20 | 73 74 65 70 20 28 31 29 |}..When |step (1)|
|00003e50| 20 66 69 6e 69 73 68 65 | 73 20 77 69 74 68 6f 75 | finishe|s withou|
|00003e60| 74 20 72 61 69 73 69 6e | 67 20 61 6e 20 65 78 63 |t raisin|g an exc|
|00003e70| 65 70 74 69 6f 6e 2c 20 | 73 74 65 70 20 28 32 29 |eption, |step (2)|
|00003e80| 20 63 61 6e 0d 62 65 67 | 69 6e 2e 0d 0d 54 68 65 | can.beg|in...The|
|00003e90| 20 66 69 72 73 74 20 66 | 6f 72 6d 20 6f 66 20 5c | first f|orm of \|
|00003ea0| 76 65 72 62 40 69 6d 70 | 6f 72 74 40 20 73 74 61 |verb@imp|ort@ sta|
|00003eb0| 74 65 6d 65 6e 74 20 62 | 69 6e 64 73 20 74 68 65 |tement b|inds the|
|00003ec0| 20 6d 6f 64 75 6c 65 20 | 6e 61 6d 65 20 69 6e 20 | module |name in |
|00003ed0| 74 68 65 0d 6c 6f 63 61 | 6c 20 6e 61 6d 65 20 73 |the.loca|l name s|
|00003ee0| 70 61 63 65 20 74 6f 20 | 74 68 65 20 6d 6f 64 75 |pace to |the modu|
|00003ef0| 6c 65 20 6f 62 6a 65 63 | 74 2c 20 61 6e 64 20 74 |le objec|t, and t|
|00003f00| 68 65 6e 20 67 6f 65 73 | 20 6f 6e 20 74 6f 20 69 |hen goes| on to i|
|00003f10| 6d 70 6f 72 74 20 74 68 | 65 0d 6e 65 78 74 20 69 |mport th|e.next i|
|00003f20| 64 65 6e 74 69 66 69 65 | 72 2c 20 69 66 20 61 6e |dentifie|r, if an|
|00003f30| 79 2e 20 20 54 68 65 20 | 5c 76 65 72 62 40 66 72 |y. The |\verb@fr|
|00003f40| 6f 6d 40 20 66 72 6f 6d | 20 64 6f 65 73 20 6e 6f |om@ from| does no|
|00003f50| 74 20 62 69 6e 64 20 74 | 68 65 0d 6d 6f 64 75 6c |t bind t|he.modul|
|00003f60| 65 20 6e 61 6d 65 3a 20 | 69 74 20 67 6f 65 73 20 |e name: |it goes |
|00003f70| 74 68 72 6f 75 67 68 20 | 74 68 65 20 6c 69 73 74 |through |the list|
|00003f80| 20 6f 66 20 69 64 65 6e | 74 69 66 69 65 72 73 2c | of iden|tifiers,|
|00003f90| 20 6c 6f 6f 6b 73 20 65 | 61 63 68 20 6f 6e 65 0d | looks e|ach one.|
|00003fa0| 6f 66 20 74 68 65 6d 20 | 75 70 20 69 6e 20 74 68 |of them |up in th|
|00003fb0| 65 20 6d 6f 64 75 6c 65 | 20 66 6f 75 6e 64 20 69 |e module| found i|
|00003fc0| 6e 20 73 74 65 70 20 28 | 31 29 2c 20 61 6e 64 20 |n step (|1), and |
|00003fd0| 62 69 6e 64 73 20 74 68 | 65 20 6e 61 6d 65 20 69 |binds th|e name i|
|00003fe0| 6e 20 74 68 65 0d 6c 6f | 63 61 6c 20 6e 61 6d 65 |n the.lo|cal name|
|00003ff0| 20 73 70 61 63 65 20 74 | 6f 20 74 68 65 20 6f 62 | space t|o the ob|
|00004000| 6a 65 63 74 20 74 68 75 | 73 20 66 6f 75 6e 64 2e |ject thu|s found.|
|00004010| 20 20 49 66 20 61 20 6e | 61 6d 65 20 69 73 20 6e | If a n|ame is n|
|00004020| 6f 74 20 66 6f 75 6e 64 | 2c 0d 5c 76 65 72 62 40 |ot found|,.\verb@|
|00004030| 49 6d 70 6f 72 74 45 72 | 72 6f 72 40 20 69 73 20 |ImportEr|ror@ is |
|00004040| 72 61 69 73 65 64 2e 20 | 20 49 66 20 74 68 65 20 |raised. | If the |
|00004050| 6c 69 73 74 20 6f 66 20 | 69 64 65 6e 74 69 66 69 |list of |identifi|
|00004060| 65 72 73 20 69 73 20 72 | 65 70 6c 61 63 65 64 0d |ers is r|eplaced.|
|00004070| 62 79 20 61 20 73 74 61 | 72 20 28 5c 76 65 72 62 |by a sta|r (\verb|
|00004080| 40 2a 40 29 2c 20 61 6c | 6c 20 6e 61 6d 65 73 20 |@*@), al|l names |
|00004090| 64 65 66 69 6e 65 64 20 | 69 6e 20 74 68 65 20 6d |defined |in the m|
|000040a0| 6f 64 75 6c 65 20 61 72 | 65 20 62 6f 75 6e 64 2c |odule ar|e bound,|
|000040b0| 0d 65 78 63 65 70 74 20 | 74 68 6f 73 65 20 62 65 |.except |those be|
|000040c0| 67 69 6e 6e 69 6e 67 20 | 77 69 74 68 20 61 6e 20 |ginning |with an |
|000040d0| 75 6e 64 65 72 73 63 6f | 72 65 28 5c 76 65 72 62 |undersco|re(\verb|
|000040e0| 40 5f 40 29 2e 0d 5c 69 | 6e 64 65 78 69 69 7b 6e |@_@)..\i|ndexii{n|
|000040f0| 61 6d 65 7d 7b 62 69 6e | 64 69 6e 67 7d 0d 5c 65 |ame}{bin|ding}.\e|
|00004100| 78 69 6e 64 65 78 7b 49 | 6d 70 6f 72 74 45 72 72 |xindex{I|mportErr|
|00004110| 6f 72 7d 0d 0d 4e 61 6d | 65 73 20 62 6f 75 6e 64 |or}..Nam|es bound|
|00004120| 20 62 79 20 69 6d 70 6f | 72 74 20 73 74 61 74 65 | by impo|rt state|
|00004130| 6d 65 6e 74 73 20 6d 61 | 79 20 6e 6f 74 20 6f 63 |ments ma|y not oc|
|00004140| 63 75 72 20 69 6e 20 5c | 76 65 72 62 40 67 6c 6f |cur in \|verb@glo|
|00004150| 62 61 6c 40 0d 73 74 61 | 74 65 6d 65 6e 74 73 20 |bal@.sta|tements |
|00004160| 69 6e 20 74 68 65 20 73 | 61 6d 65 20 73 63 6f 70 |in the s|ame scop|
|00004170| 65 2e 0d 5c 73 74 69 6e | 64 65 78 7b 67 6c 6f 62 |e..\stin|dex{glob|
|00004180| 61 6c 7d 0d 0d 54 68 65 | 20 5c 76 65 72 62 40 66 |al}..The| \verb@f|
|00004190| 72 6f 6d 40 20 66 6f 72 | 6d 20 77 69 74 68 20 5c |rom@ for|m with \|
|000041a0| 76 65 72 62 40 2a 40 20 | 6d 61 79 20 6f 6e 6c 79 |verb@*@ |may only|
|000041b0| 20 6f 63 63 75 72 20 69 | 6e 20 61 20 6d 6f 64 75 | occur i|n a modu|
|000041c0| 6c 65 20 73 63 6f 70 65 | 2e 0d 5c 6b 77 69 6e 64 |le scope|..\kwind|
|000041d0| 65 78 7b 66 72 6f 6d 7d | 0d 5c 74 74 69 6e 64 65 |ex{from}|.\ttinde|
|000041e0| 78 7b 66 72 6f 6d 20 2e | 2e 2e 20 69 6d 70 6f 72 |x{from .|.. impor|
|000041f0| 74 20 2a 7d 0d 0d 28 54 | 68 65 20 63 75 72 72 65 |t *}..(T|he curre|
|00004200| 6e 74 20 69 6d 70 6c 65 | 6d 65 6e 74 61 74 69 6f |nt imple|mentatio|
|00004210| 6e 20 64 6f 65 73 20 6e | 6f 74 20 65 6e 66 6f 72 |n does n|ot enfor|
|00004220| 63 65 20 74 68 65 20 6c | 61 74 74 65 72 20 74 77 |ce the l|atter tw|
|00004230| 6f 0d 72 65 73 74 72 69 | 63 74 69 6f 6e 73 2c 20 |o.restri|ctions, |
|00004240| 62 75 74 20 70 72 6f 67 | 72 61 6d 73 20 73 68 6f |but prog|rams sho|
|00004250| 75 6c 64 20 6e 6f 74 20 | 61 62 75 73 65 20 74 68 |uld not |abuse th|
|00004260| 69 73 20 66 72 65 65 64 | 6f 6d 2c 20 61 73 20 66 |is freed|om, as f|
|00004270| 75 74 75 72 65 0d 69 6d | 70 6c 65 6d 65 6e 74 61 |uture.im|plementa|
|00004280| 74 69 6f 6e 73 20 6d 61 | 79 20 65 6e 66 6f 72 63 |tions ma|y enforc|
|00004290| 65 20 74 68 65 6d 20 6f | 72 20 73 69 6c 65 6e 74 |e them o|r silent|
|000042a0| 6c 79 20 63 68 61 6e 67 | 65 20 74 68 65 20 6d 65 |ly chang|e the me|
|000042b0| 61 6e 69 6e 67 20 6f 66 | 20 74 68 65 0d 70 72 6f |aning of| the.pro|
|000042c0| 67 72 61 6d 2e 29 0d 0d | 5c 73 65 63 74 69 6f 6e |gram.)..|\section|
|000042d0| 7b 54 68 65 20 7b 5c 74 | 74 20 67 6c 6f 62 61 6c |{The {\t|t global|
|000042e0| 7d 20 73 74 61 74 65 6d | 65 6e 74 7d 20 5c 6c 61 |} statem|ent} \la|
|000042f0| 62 65 6c 7b 67 6c 6f 62 | 61 6c 7d 0d 5c 73 74 69 |bel{glob|al}.\sti|
|00004300| 6e 64 65 78 7b 67 6c 6f | 62 61 6c 7d 0d 0d 5c 62 |ndex{glo|bal}..\b|
|00004310| 65 67 69 6e 7b 76 65 72 | 62 61 74 69 6d 7d 0d 67 |egin{ver|batim}.g|
|00004320| 6c 6f 62 61 6c 5f 73 74 | 6d 74 3a 20 20 20 20 22 |lobal_st|mt: "|
|00004330| 67 6c 6f 62 61 6c 22 20 | 69 64 65 6e 74 69 66 69 |global" |identifi|
|00004340| 65 72 20 28 22 2c 22 20 | 69 64 65 6e 74 69 66 69 |er ("," |identifi|
|00004350| 65 72 29 2a 0d 5c 65 6e | 64 7b 76 65 72 62 61 74 |er)*.\en|d{verbat|
|00004360| 69 6d 7d 0d 0d 54 68 65 | 20 5c 76 65 72 62 40 67 |im}..The| \verb@g|
|00004370| 6c 6f 62 61 6c 40 20 73 | 74 61 74 65 6d 65 6e 74 |lobal@ s|tatement|
|00004380| 20 69 73 20 61 20 64 65 | 63 6c 61 72 61 74 69 6f | is a de|claratio|
|00004390| 6e 20 77 68 69 63 68 20 | 68 6f 6c 64 73 20 66 6f |n which |holds fo|
|000043a0| 72 20 74 68 65 0d 65 6e | 74 69 72 65 20 63 75 72 |r the.en|tire cur|
|000043b0| 72 65 6e 74 20 73 63 6f | 70 65 2e 20 20 49 74 20 |rent sco|pe. It |
|000043c0| 6d 65 61 6e 73 20 74 68 | 61 74 20 74 68 65 20 6c |means th|at the l|
|000043d0| 69 73 74 65 64 20 69 64 | 65 6e 74 69 66 69 65 72 |isted id|entifier|
|000043e0| 73 20 61 72 65 20 74 6f | 20 62 65 0d 69 6e 74 65 |s are to| be.inte|
|000043f0| 72 70 72 65 74 65 64 20 | 61 73 20 67 6c 6f 62 61 |rpreted |as globa|
|00004400| 6c 73 2e 20 20 57 68 69 | 6c 65 20 7b 5c 65 6d 20 |ls. Whi|le {\em |
|00004410| 75 73 69 6e 67 7d 20 67 | 6c 6f 62 61 6c 20 6e 61 |using} g|lobal na|
|00004420| 6d 65 73 20 69 73 20 61 | 75 74 6f 6d 61 74 69 63 |mes is a|utomatic|
|00004430| 0d 69 66 20 74 68 65 79 | 20 61 72 65 20 6e 6f 74 |.if they| are not|
|00004440| 20 64 65 66 69 6e 65 64 | 20 69 6e 20 74 68 65 20 | defined| in the |
|00004450| 6c 6f 63 61 6c 20 73 63 | 6f 70 65 2c 20 7b 5c 65 |local sc|ope, {\e|
|00004460| 6d 20 61 73 73 69 67 6e | 69 6e 67 7d 20 74 6f 20 |m assign|ing} to |
|00004470| 67 6c 6f 62 61 6c 0d 6e | 61 6d 65 73 20 77 6f 75 |global.n|ames wou|
|00004480| 6c 64 20 62 65 20 69 6d | 70 6f 73 73 69 62 6c 65 |ld be im|possible|
|00004490| 20 77 69 74 68 6f 75 74 | 20 5c 76 65 72 62 40 67 | without| \verb@g|
|000044a0| 6c 6f 62 61 6c 40 2e 0d | 5c 69 6e 64 65 78 69 69 |lobal@..|\indexii|
|000044b0| 69 7b 67 6c 6f 62 61 6c | 7d 7b 6e 61 6d 65 7d 7b |i{global|}{name}{|
|000044c0| 62 69 6e 64 69 6e 67 7d | 0d 0d 4e 61 6d 65 73 20 |binding}|..Names |
|000044d0| 6c 69 73 74 65 64 20 69 | 6e 20 61 20 5c 76 65 72 |listed i|n a \ver|
|000044e0| 62 40 67 6c 6f 62 61 6c | 40 20 73 74 61 74 65 6d |b@global|@ statem|
|000044f0| 65 6e 74 20 6d 75 73 74 | 20 6e 6f 74 20 62 65 20 |ent must| not be |
|00004500| 75 73 65 64 20 69 6e 20 | 74 68 65 20 73 61 6d 65 |used in |the same|
|00004510| 0d 73 63 6f 70 65 20 62 | 65 66 6f 72 65 20 74 68 |.scope b|efore th|
|00004520| 61 74 20 5c 76 65 72 62 | 40 67 6c 6f 62 61 6c 40 |at \verb|@global@|
|00004530| 20 73 74 61 74 65 6d 65 | 6e 74 20 69 73 20 65 78 | stateme|nt is ex|
|00004540| 65 63 75 74 65 64 2e 0d | 0d 4e 61 6d 65 73 20 6c |ecuted..|.Names l|
|00004550| 69 73 74 65 64 20 69 6e | 20 61 20 5c 76 65 72 62 |isted in| a \verb|
|00004560| 40 67 6c 6f 62 61 6c 40 | 20 73 74 61 74 65 6d 65 |@global@| stateme|
|00004570| 6e 74 20 6d 75 73 74 20 | 6e 6f 74 20 62 65 20 64 |nt must |not be d|
|00004580| 65 66 69 6e 65 64 20 61 | 73 20 66 6f 72 6d 61 6c |efined a|s formal|
|00004590| 0d 70 61 72 61 6d 65 74 | 65 72 73 20 6f 72 20 69 |.paramet|ers or i|
|000045a0| 6e 20 61 20 5c 76 65 72 | 62 40 66 6f 72 40 20 6c |n a \ver|b@for@ l|
|000045b0| 6f 6f 70 20 63 6f 6e 74 | 72 6f 6c 20 74 61 72 67 |oop cont|rol targ|
|000045c0| 65 74 2c 20 5c 76 65 72 | 62 40 63 6c 61 73 73 40 |et, \ver|b@class@|
|000045d0| 0d 64 65 66 69 6e 69 74 | 69 6f 6e 2c 20 66 75 6e |.definit|ion, fun|
|000045e0| 63 74 69 6f 6e 20 64 65 | 66 69 6e 69 74 69 6f 6e |ction de|finition|
|000045f0| 2c 20 6f 72 20 5c 76 65 | 72 62 40 69 6d 70 6f 72 |, or \ve|rb@impor|
|00004600| 74 40 20 73 74 61 74 65 | 6d 65 6e 74 2e 0d 0d 28 |t@ state|ment...(|
|00004610| 54 68 65 20 63 75 72 72 | 65 6e 74 20 69 6d 70 6c |The curr|ent impl|
|00004620| 65 6d 65 6e 74 61 74 69 | 6f 6e 20 64 6f 65 73 20 |ementati|on does |
|00004630| 6e 6f 74 20 65 6e 66 6f | 72 63 65 20 74 68 65 20 |not enfo|rce the |
|00004640| 6c 61 74 74 65 72 20 74 | 77 6f 0d 72 65 73 74 72 |latter t|wo.restr|
|00004650| 69 63 74 69 6f 6e 73 2c | 20 62 75 74 20 70 72 6f |ictions,| but pro|
|00004660| 67 72 61 6d 73 20 73 68 | 6f 75 6c 64 20 6e 6f 74 |grams sh|ould not|
|00004670| 20 61 62 75 73 65 20 74 | 68 69 73 20 66 72 65 65 | abuse t|his free|
|00004680| 64 6f 6d 2c 20 61 73 20 | 66 75 74 75 72 65 0d 69 |dom, as |future.i|
|00004690| 6d 70 6c 65 6d 65 6e 74 | 61 74 69 6f 6e 73 20 6d |mplement|ations m|
|000046a0| 61 79 20 65 6e 66 6f 72 | 63 65 20 74 68 65 6d 20 |ay enfor|ce them |
|000046b0| 6f 72 20 73 69 6c 65 6e | 74 6c 79 20 63 68 61 6e |or silen|tly chan|
|000046c0| 67 65 20 74 68 65 20 6d | 65 61 6e 69 6e 67 20 6f |ge the m|eaning o|
|000046d0| 66 20 74 68 65 0d 70 72 | 6f 67 72 61 6d 2e 29 0d |f the.pr|ogram.).|
|000046e0| 0d 5c 73 65 63 74 69 6f | 6e 7b 54 68 65 20 7b 5c |.\sectio|n{The {\|
|000046f0| 74 74 20 61 63 63 65 73 | 73 7d 20 73 74 61 74 65 |tt acces|s} state|
|00004700| 6d 65 6e 74 7d 20 5c 6c | 61 62 65 6c 7b 61 63 63 |ment} \l|abel{acc|
|00004710| 65 73 73 7d 0d 5c 73 74 | 69 6e 64 65 78 7b 61 63 |ess}.\st|index{ac|
|00004720| 63 65 73 73 7d 0d 0d 5c | 62 65 67 69 6e 7b 76 65 |cess}..\|begin{ve|
|00004730| 72 62 61 74 69 6d 7d 0d | 61 63 63 65 73 73 5f 73 |rbatim}.|access_s|
|00004740| 74 6d 74 3a 20 20 20 20 | 22 61 63 63 65 73 73 22 |tmt: |"access"|
|00004750| 20 2e 2e 2e 0d 5c 65 6e | 64 7b 76 65 72 62 61 74 | ....\en|d{verbat|
|00004760| 69 6d 7d 0d 0d 54 68 69 | 73 20 73 74 61 74 65 6d |im}..Thi|s statem|
|00004770| 65 6e 74 20 69 73 20 6f | 62 73 6f 6c 65 74 65 2e |ent is o|bsolete.|
|00004780| 20 20 49 74 20 6e 6f 20 | 6c 6f 6e 67 65 72 20 67 | It no |longer g|
|00004790| 65 6e 65 72 61 74 65 73 | 20 61 6e 79 20 63 6f 64 |enerates| any cod|
|000047a0| 65 3b 20 69 6e 20 74 68 | 65 0d 66 75 74 75 72 65 |e; in th|e.future|
|000047b0| 2c 20 5c 76 65 72 62 40 | 61 63 63 65 73 73 40 20 |, \verb@|access@ |
|000047c0| 77 69 6c 6c 20 6e 6f 20 | 6c 6f 6e 67 65 72 20 62 |will no |longer b|
|000047d0| 65 20 61 20 72 65 73 65 | 72 76 65 64 20 77 6f 72 |e a rese|rved wor|
|000047e0| 64 2e 0d 0d 5c 73 65 63 | 74 69 6f 6e 7b 54 68 65 |d...\sec|tion{The|
|000047f0| 20 7b 5c 74 74 20 65 78 | 65 63 7d 20 73 74 61 74 | {\tt ex|ec} stat|
|00004800| 65 6d 65 6e 74 7d 20 5c | 6c 61 62 65 6c 7b 65 78 |ement} \|label{ex|
|00004810| 65 63 7d 0d 5c 73 74 69 | 6e 64 65 78 7b 65 78 65 |ec}.\sti|ndex{exe|
|00004820| 63 7d 0d 0d 5c 62 65 67 | 69 6e 7b 76 65 72 62 61 |c}..\beg|in{verba|
|00004830| 74 69 6d 7d 0d 65 78 65 | 63 5f 73 74 6d 74 3a 20 |tim}.exe|c_stmt: |
|00004840| 20 20 20 22 65 78 65 63 | 22 20 65 78 70 72 65 73 | "exec|" expres|
|00004850| 73 69 6f 6e 20 5b 22 69 | 6e 22 20 65 78 70 72 65 |sion ["i|n" expre|
|00004860| 73 73 69 6f 6e 20 5b 22 | 2c 22 20 65 78 70 72 65 |ssion ["|," expre|
|00004870| 73 73 69 6f 6e 5d 5d 0d | 5c 65 6e 64 7b 76 65 72 |ssion]].|\end{ver|
|00004880| 62 61 74 69 6d 7d 0d 0d | 54 68 69 73 20 73 74 61 |batim}..|This sta|
|00004890| 74 65 6d 65 6e 74 20 73 | 75 70 70 6f 72 74 73 20 |tement s|upports |
|000048a0| 64 79 6e 61 6d 69 63 20 | 65 78 65 63 75 74 69 6f |dynamic |executio|
|000048b0| 6e 20 6f 66 20 50 79 74 | 68 6f 6e 20 63 6f 64 65 |n of Pyt|hon code|
|000048c0| 2e 20 20 54 68 65 20 66 | 69 72 73 74 0d 65 78 70 |. The f|irst.exp|
|000048d0| 72 65 73 73 69 6f 6e 20 | 73 68 6f 75 6c 64 20 65 |ression |should e|
|000048e0| 76 61 6c 75 61 74 65 20 | 74 6f 20 65 69 74 68 65 |valuate |to eithe|
|000048f0| 72 20 61 20 73 74 72 69 | 6e 67 2c 20 61 6e 20 6f |r a stri|ng, an o|
|00004900| 70 65 6e 20 66 69 6c 65 | 20 6f 62 6a 65 63 74 2c |pen file| object,|
|00004910| 20 6f 72 0d 61 20 63 6f | 64 65 20 6f 62 6a 65 63 | or.a co|de objec|
|00004920| 74 2e 20 20 49 66 20 69 | 74 20 69 73 20 61 20 73 |t. If i|t is a s|
|00004930| 74 72 69 6e 67 2c 20 74 | 68 65 20 73 74 72 69 6e |tring, t|he strin|
|00004940| 67 20 69 73 20 70 61 72 | 73 65 64 20 61 73 20 61 |g is par|sed as a|
|00004950| 20 73 75 69 74 65 20 6f | 66 0d 50 79 74 68 6f 6e | suite o|f.Python|
|00004960| 20 73 74 61 74 65 6d 65 | 6e 74 73 20 77 68 69 63 | stateme|nts whic|
|00004970| 68 20 69 73 20 74 68 65 | 6e 20 65 78 65 63 75 74 |h is the|n execut|
|00004980| 65 64 20 28 75 6e 6c 65 | 73 73 20 61 20 73 79 6e |ed (unle|ss a syn|
|00004990| 74 61 78 20 65 72 72 6f | 72 0d 6f 63 63 75 72 73 |tax erro|r.occurs|
|000049a0| 29 2e 20 20 49 66 20 69 | 74 20 69 73 20 61 6e 20 |). If i|t is an |
|000049b0| 6f 70 65 6e 20 66 69 6c | 65 2c 20 74 68 65 20 66 |open fil|e, the f|
|000049c0| 69 6c 65 20 69 73 20 70 | 61 72 73 65 64 20 75 6e |ile is p|arsed un|
|000049d0| 74 69 6c 20 45 4f 46 20 | 61 6e 64 0d 65 78 65 63 |til EOF |and.exec|
|000049e0| 75 74 65 64 2e 20 20 49 | 66 20 69 74 20 69 73 20 |uted. I|f it is |
|000049f0| 61 20 63 6f 64 65 20 6f | 62 6a 65 63 74 2c 20 69 |a code o|bject, i|
|00004a00| 74 20 69 73 20 73 69 6d | 70 6c 79 20 65 78 65 63 |t is sim|ply exec|
|00004a10| 75 74 65 64 2e 0d 0d 49 | 6e 20 61 6c 6c 20 63 61 |uted...I|n all ca|
|00004a20| 73 65 73 2c 20 69 66 20 | 74 68 65 20 6f 70 74 69 |ses, if |the opti|
|00004a30| 6f 6e 61 6c 20 70 61 72 | 74 73 20 61 72 65 20 6f |onal par|ts are o|
|00004a40| 6d 69 74 74 65 64 2c 20 | 74 68 65 20 63 6f 64 65 |mitted, |the code|
|00004a50| 20 69 73 20 65 78 65 63 | 75 74 65 64 0d 69 6e 20 | is exec|uted.in |
|00004a60| 74 68 65 20 63 75 72 72 | 65 6e 74 20 73 63 6f 70 |the curr|ent scop|
|00004a70| 65 2e 20 20 49 66 20 6f | 6e 6c 79 20 74 68 65 20 |e. If o|nly the |
|00004a80| 66 69 72 73 74 20 65 78 | 70 72 65 73 73 69 6f 6e |first ex|pression|
|00004a90| 20 61 66 74 65 72 20 5c | 76 65 72 62 40 69 6e 40 | after \|verb@in@|
|00004aa0| 20 69 73 0d 73 70 65 63 | 69 66 69 65 64 2c 20 69 | is.spec|ified, i|
|00004ab0| 74 20 73 68 6f 75 6c 64 | 20 62 65 20 61 20 64 69 |t should| be a di|
|00004ac0| 63 74 69 6f 6e 61 72 79 | 2c 20 77 68 69 63 68 20 |ctionary|, which |
|00004ad0| 77 69 6c 6c 20 62 65 20 | 75 73 65 64 20 66 6f 72 |will be |used for|
|00004ae0| 20 62 6f 74 68 20 74 68 | 65 0d 67 6c 6f 62 61 6c | both th|e.global|
|00004af0| 20 61 6e 64 20 74 68 65 | 20 6c 6f 63 61 6c 20 76 | and the| local v|
|00004b00| 61 72 69 61 62 6c 65 73 | 2e 20 20 49 66 20 74 77 |ariables|. If tw|
|00004b10| 6f 20 65 78 70 72 65 73 | 73 69 6f 6e 73 20 61 72 |o expres|sions ar|
|00004b20| 65 20 67 69 76 65 6e 2c | 20 62 6f 74 68 0d 6d 75 |e given,| both.mu|
|00004b30| 73 74 20 62 65 20 64 69 | 63 74 69 6f 6e 61 72 69 |st be di|ctionari|
|00004b40| 65 73 20 61 6e 64 20 74 | 68 65 79 20 61 72 65 20 |es and t|hey are |
|00004b50| 75 73 65 64 20 66 6f 72 | 20 74 68 65 20 67 6c 6f |used for| the glo|
|00004b60| 62 61 6c 20 61 6e 64 20 | 6c 6f 63 61 6c 0d 76 61 |bal and |local.va|
|00004b70| 72 69 61 62 6c 65 73 2c | 20 72 65 73 70 65 63 74 |riables,| respect|
|00004b80| 69 76 65 6c 79 2e 0d 0d | 48 69 6e 74 73 3a 20 64 |ively...|Hints: d|
|00004b90| 79 6e 61 6d 69 63 20 65 | 76 61 6c 75 61 74 69 6f |ynamic e|valuatio|
|00004ba0| 6e 20 6f 66 20 65 78 70 | 72 65 73 73 69 6f 6e 73 |n of exp|ressions|
|00004bb0| 20 69 73 20 73 75 70 70 | 6f 72 74 65 64 20 62 79 | is supp|orted by|
|00004bc0| 20 74 68 65 20 62 75 69 | 6c 74 2d 69 6e 0d 66 75 | the bui|lt-in.fu|
|00004bd0| 6e 63 74 69 6f 6e 20 5c | 76 65 72 62 40 65 76 61 |nction \|verb@eva|
|00004be0| 6c 28 29 40 2e 20 20 54 | 68 65 20 62 75 69 6c 74 |l()@. T|he built|
|00004bf0| 2d 69 6e 20 66 75 6e 63 | 74 69 6f 6e 73 20 5c 76 |-in func|tions \v|
|00004c00| 65 72 62 40 67 6c 6f 62 | 61 6c 73 28 29 40 20 61 |erb@glob|als()@ a|
|00004c10| 6e 64 0d 5c 76 65 72 62 | 40 6c 6f 63 61 6c 73 28 |nd.\verb|@locals(|
|00004c20| 29 40 20 72 65 74 75 72 | 6e 20 74 68 65 20 63 75 |)@ retur|n the cu|
|00004c30| 72 72 65 6e 74 20 67 6c | 6f 62 61 6c 20 61 6e 64 |rrent gl|obal and|
|00004c40| 20 6c 6f 63 61 6c 20 64 | 69 63 74 69 6f 6e 61 72 | local d|ictionar|
|00004c50| 79 2c 0d 72 65 73 70 65 | 63 74 69 76 65 6c 79 2c |y,.respe|ctively,|
|00004c60| 20 77 68 69 63 68 20 6d | 61 79 20 62 65 20 75 73 | which m|ay be us|
|00004c70| 65 66 75 6c 20 74 6f 20 | 70 61 73 73 20 61 72 6f |eful to |pass aro|
|00004c80| 75 6e 64 20 66 6f 72 20 | 75 73 65 20 62 79 20 5c |und for |use by \|
|00004c90| 76 65 72 62 40 65 78 65 | 63 40 2e 0d |verb@exe|c@.. |
+--------+-------------------------+-------------------------+--------+--------+